Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name = "stackfuture"
description = "StackFuture is a wrapper around futures that stores the wrapped future in space provided by the caller."
version = "0.3.0"
edition = "2021"
edition = "2024"
license = "MIT"
authors = ["Microsoft"]
repository = "https://github.com/microsoft/stackfuture"
Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
edition = "2021"
edition = "2024"
reorder_imports = true
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,19 +378,22 @@ impl<F> IntoStackFutureError<F> {
impl<F> Display for IntoStackFutureError<F> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match (self.alignment_too_small(), self.insufficient_space()) {
(true, true) => write!(f,
(true, true) => write!(
f,
"cannot create StackFuture, required size is {}, available space is {}; required alignment is {} but maximum alignment is {}",
self.required_space(),
self.available_space(),
self.required_alignment(),
self.available_alignment()
),
(true, false) => write!(f,
(true, false) => write!(
f,
"cannot create StackFuture, required alignment is {} but maximum alignment is {}",
self.required_alignment(),
self.available_alignment()
),
(false, true) => write!(f,
(false, true) => write!(
f,
"cannot create StackFuture, required size is {}, available space is {}",
self.required_space(),
self.available_space()
Expand Down
9 changes: 6 additions & 3 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::StackFuture;
use core::task::Poll;
use futures::channel::mpsc;
use futures::executor::block_on;
use futures::pin_mut;
use futures::Future;
use futures::SinkExt;
use futures::Stream;
use futures::StreamExt;
use futures::channel::mpsc;
use futures::executor::block_on;
use futures::pin_mut;
use std::sync::Arc;
use std::task::Context;
use std::task::Wake;
Expand Down Expand Up @@ -103,6 +103,7 @@ fn test_alignment() {
// A test to make sure we store the wrapped future with the correct alignment

#[repr(align(8))]
#[allow(dead_code)]
struct BigAlignment(u32);

impl Future for BigAlignment {
Expand All @@ -121,6 +122,7 @@ fn test_alignment_failure() {
// A test to make sure we store the wrapped future with the correct alignment

#[repr(align(256))]
#[allow(dead_code)]
struct BigAlignment(u32);

impl Future for BigAlignment {
Expand All @@ -142,6 +144,7 @@ fn test_boxed_alignment() {
// A test to make sure we store the wrapped future with the correct alignment

#[repr(align(256))]
#[allow(dead_code)]
struct BigAlignment(u32);

impl Future for BigAlignment {
Expand Down