mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 14:53:03 +00:00
Better SpawnToken error messages
This commit is contained in:
parent
80c504cd95
commit
db8b4ca565
@ -225,15 +225,15 @@ unsafe impl<F: Future + 'static> Sync for Task<F> {}
|
||||
//=============
|
||||
// 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<NonNull<Header>>,
|
||||
}
|
||||
|
||||
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()")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user