From fbdb19781640f08672a1935feae59a6edd19dc5b Mon Sep 17 00:00:00 2001 From: Gunnar Schulze Date: Wed, 29 Oct 2025 06:52:33 +0100 Subject: [PATCH 1/2] Print detailed panic messages --- Cargo.toml | 1 + src/lib.rs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) 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..6660e7b 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!( + "F is too large: ", + StackFuture::::required_space::(), + " > ", + STACK_SIZE + ); } if !StackFuture::::has_alignment_for::() { - panic!("F has incompatible alignment"); + concat_panic!( + "F has incompatible alignment: ", + align_of::(), + " > ", + align_of::>() + ); } }; } From 611c6afca608fb121780386cbf127662029b1a35 Mon Sep 17 00:00:00 2001 From: Gunnar Schulze Date: Mon, 3 Nov 2025 08:21:10 +0100 Subject: [PATCH 2/2] Change 'F' to 'Future' in panic messages --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6660e7b..8d9801e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -306,7 +306,7 @@ impl AssertFits { const ASSERT: () = { if !StackFuture::::has_space_for::() { concat_panic!( - "F is too large: ", + "Future is too large: ", StackFuture::::required_space::(), " > ", STACK_SIZE @@ -315,7 +315,7 @@ impl AssertFits { if !StackFuture::::has_alignment_for::() { concat_panic!( - "F has incompatible alignment: ", + "Future has incompatible alignment: ", align_of::(), " > ", align_of::>()