diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-07-08 20:19:01 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-07-08 20:27:35 +0200 |
| commit | 2fe2a0cf9c15bf7e84134cd7fec48017bb0a0db7 (patch) | |
| tree | e9603081d1c84297878ace77762adbbaa92cb7a3 /embassy-executor/tests/ui/spawn_nonsend.rs | |
| parent | 504261a8d0bc58fcfa8b73245eaf859f88d62a94 (diff) | |
excutor: fix Send unsoundness with `-> impl Future` tasks.
Diffstat (limited to 'embassy-executor/tests/ui/spawn_nonsend.rs')
| -rw-r--r-- | embassy-executor/tests/ui/spawn_nonsend.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/embassy-executor/tests/ui/spawn_nonsend.rs b/embassy-executor/tests/ui/spawn_nonsend.rs new file mode 100644 index 000000000..4c4cc7697 --- /dev/null +++ b/embassy-executor/tests/ui/spawn_nonsend.rs | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #![cfg_attr(feature = "nightly", feature(impl_trait_in_assoc_type))] | ||
| 2 | |||
| 3 | use core::future::Future; | ||
| 4 | |||
| 5 | use embassy_executor::SendSpawner; | ||
| 6 | |||
| 7 | #[embassy_executor::task] | ||
| 8 | async fn task(non_send: *mut ()) { | ||
| 9 | println!("{}", non_send as usize); | ||
| 10 | } | ||
| 11 | |||
| 12 | fn send_spawn(s: SendSpawner) { | ||
| 13 | s.spawn(task(core::ptr::null_mut())).unwrap(); | ||
| 14 | } | ||
| 15 | |||
| 16 | fn main() {} | ||
