From db8b4ca56533eb743f8b00b904581bc99e4c9597 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 26 Dec 2020 15:15:50 +0100 Subject: [PATCH] Better SpawnToken error messages --- embassy/src/executor/executor.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/embassy/src/executor/executor.rs b/embassy/src/executor/executor.rs index 4d73cf9f..81a91577 100644 --- a/embassy/src/executor/executor.rs +++ b/embassy/src/executor/executor.rs @@ -225,15 +225,15 @@ unsafe impl Sync for Task {} //============= // Spawn token -#[must_use = "Calling a task function does nothing on its own. To spawn a task, pass the result to Executor::spawn()"] +#[must_use = "Calling a task function does nothing on its own. You must pass the returned SpawnToken to Executor::spawn()"] pub struct SpawnToken { header: Option>, } impl Drop for SpawnToken { fn drop(&mut self) { - // TODO maybe we can deallocate the task instead. - panic!("Please do not drop SpawnToken instances") + // TODO deallocate the task instead. + panic!("SpawnToken instances may not be dropped. You must pass them to Executor::spawn()") } }