diff --git a/Cargo.toml b/Cargo.toml index f096c6e..b28ef32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ keywords = ["async", "no_std", "futures"] categories = ["asynchronous", "no-std", "rust-patterns"] [dependencies] +const_panic = "0.2" [dev-dependencies] futures = { version = "0.3", features = ["executor"] } diff --git a/src/lib.rs b/src/lib.rs index dd54a1c..8d9801e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,7 @@ #![cfg_attr(not(test), no_std)] #![warn(missing_docs)] +use const_panic::concat_panic; use core::fmt::Debug; use core::fmt::Display; use core::future::Future; @@ -304,11 +305,21 @@ struct AssertFits(PhantomData); impl AssertFits { const ASSERT: () = { if !StackFuture::::has_space_for::() { - panic!("F is too large"); + concat_panic!( + "Future is too large: ", + StackFuture::::required_space::(), + " > ", + STACK_SIZE + ); } if !StackFuture::::has_alignment_for::() { - panic!("F has incompatible alignment"); + concat_panic!( + "Future has incompatible alignment: ", + align_of::(), + " > ", + align_of::>() + ); } }; }