diff options
| author | everdrone <[email protected]> | 2025-11-11 15:48:56 +0100 |
|---|---|---|
| committer | everdrone <[email protected]> | 2025-11-11 15:48:56 +0100 |
| commit | cede7216861a82b0db55f5a88afb3acf2ace6c4b (patch) | |
| tree | d92fb578897c77f51317318c5b180931b7b25c63 /embassy-executor/tests | |
| parent | cf55b39f9a54cf3ed01f52c0565a36a444174235 (diff) | |
| parent | 3d1f09597335d3681699ba09a77da4b39ed984fd (diff) | |
Merge branch main into n6
Diffstat (limited to 'embassy-executor/tests')
| -rw-r--r-- | embassy-executor/tests/test.rs | 6 | ||||
| -rw-r--r-- | embassy-executor/tests/ui/nonstatic_struct_elided.stderr | 12 | ||||
| -rw-r--r-- | embassy-executor/tests/ui/spawn_nonsend.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/tests/ui/spawn_nonsend.stderr | 22 | ||||
| -rw-r--r-- | embassy-executor/tests/ui/task_safety_attribute.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/tests/ui/unsafe_op_in_unsafe_task.stderr | 2 |
6 files changed, 18 insertions, 28 deletions
diff --git a/embassy-executor/tests/test.rs b/embassy-executor/tests/test.rs index 6baf3dc21..a99976168 100644 --- a/embassy-executor/tests/test.rs +++ b/embassy-executor/tests/test.rs | |||
| @@ -2,14 +2,14 @@ | |||
| 2 | #![cfg_attr(feature = "nightly", feature(never_type))] | 2 | #![cfg_attr(feature = "nightly", feature(never_type))] |
| 3 | 3 | ||
| 4 | use std::boxed::Box; | 4 | use std::boxed::Box; |
| 5 | use std::future::{poll_fn, Future}; | 5 | use std::future::{Future, poll_fn}; |
| 6 | use std::sync::{Arc, Mutex}; | 6 | use std::sync::{Arc, Mutex}; |
| 7 | use std::task::Poll; | 7 | use std::task::Poll; |
| 8 | 8 | ||
| 9 | use embassy_executor::raw::Executor; | 9 | use embassy_executor::raw::Executor; |
| 10 | use embassy_executor::{task, Spawner}; | 10 | use embassy_executor::{Spawner, task}; |
| 11 | 11 | ||
| 12 | #[export_name = "__pender"] | 12 | #[unsafe(export_name = "__pender")] |
| 13 | fn __pender(context: *mut ()) { | 13 | fn __pender(context: *mut ()) { |
| 14 | unsafe { | 14 | unsafe { |
| 15 | let trace = &*(context as *const Trace); | 15 | let trace = &*(context as *const Trace); |
diff --git a/embassy-executor/tests/ui/nonstatic_struct_elided.stderr b/embassy-executor/tests/ui/nonstatic_struct_elided.stderr index 0ee1bfe0c..e6829bf5d 100644 --- a/embassy-executor/tests/ui/nonstatic_struct_elided.stderr +++ b/embassy-executor/tests/ui/nonstatic_struct_elided.stderr | |||
| @@ -9,16 +9,16 @@ help: indicate the anonymous lifetime | |||
| 9 | 6 | async fn task(_x: Foo<'_>) {} | 9 | 6 | async fn task(_x: Foo<'_>) {} |
| 10 | | ++++ | 10 | | ++++ |
| 11 | 11 | ||
| 12 | error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds | 12 | error: lifetime may not live long enough |
| 13 | --> tests/ui/nonstatic_struct_elided.rs:5:1 | 13 | --> tests/ui/nonstatic_struct_elided.rs:5:1 |
| 14 | | | 14 | | |
| 15 | 5 | #[embassy_executor::task] | 15 | 5 | #[embassy_executor::task] |
| 16 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ opaque type defined here | 16 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` |
| 17 | 6 | async fn task(_x: Foo) {} | 17 | 6 | async fn task(_x: Foo) {} |
| 18 | | --- hidden type `impl Sized` captures the anonymous lifetime defined here | 18 | | -- has type `Foo<'1>` |
| 19 | | | 19 | | |
| 20 | = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) | 20 | = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 21 | help: add a `use<...>` bound to explicitly capture `'_` | 21 | help: to declare that `impl Sized` captures data from argument `_x`, you can add an explicit `'_` lifetime bound |
| 22 | | | 22 | | |
| 23 | 5 | #[embassy_executor::task] + use<'_> | 23 | 5 | #[embassy_executor::task] + '_ |
| 24 | | +++++++++ | 24 | | ++++ |
diff --git a/embassy-executor/tests/ui/spawn_nonsend.rs b/embassy-executor/tests/ui/spawn_nonsend.rs index 601041941..a06c0b37a 100644 --- a/embassy-executor/tests/ui/spawn_nonsend.rs +++ b/embassy-executor/tests/ui/spawn_nonsend.rs | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #![cfg_attr(feature = "nightly", feature(impl_trait_in_assoc_type))] | 1 | #![cfg_attr(feature = "nightly", feature(impl_trait_in_assoc_type))] |
| 2 | 2 | ||
| 3 | use core::future::Future; | ||
| 4 | |||
| 5 | use embassy_executor::SendSpawner; | 3 | use embassy_executor::SendSpawner; |
| 6 | 4 | ||
| 7 | #[embassy_executor::task] | 5 | #[embassy_executor::task] |
diff --git a/embassy-executor/tests/ui/spawn_nonsend.stderr b/embassy-executor/tests/ui/spawn_nonsend.stderr index 25bd7d78d..31efadd49 100644 --- a/embassy-executor/tests/ui/spawn_nonsend.stderr +++ b/embassy-executor/tests/ui/spawn_nonsend.stderr | |||
| @@ -1,27 +1,19 @@ | |||
| 1 | warning: unused import: `core::future::Future` | ||
| 2 | --> tests/ui/spawn_nonsend.rs:3:5 | ||
| 3 | | | ||
| 4 | 3 | use core::future::Future; | ||
| 5 | | ^^^^^^^^^^^^^^^^^^^^ | ||
| 6 | | | ||
| 7 | = note: `#[warn(unused_imports)]` on by default | ||
| 8 | |||
| 9 | error[E0277]: `*mut ()` cannot be sent between threads safely | 1 | error[E0277]: `*mut ()` cannot be sent between threads safely |
| 10 | --> tests/ui/spawn_nonsend.rs:13:13 | 2 | --> tests/ui/spawn_nonsend.rs:11:13 |
| 11 | | | 3 | | |
| 12 | 7 | #[embassy_executor::task] | 4 | 5 | #[embassy_executor::task] |
| 13 | | ------------------------- within this `impl Sized` | 5 | | ------------------------- within this `impl Sized` |
| 14 | ... | 6 | ... |
| 15 | 13 | s.spawn(task(core::ptr::null_mut()).unwrap()); | 7 | 11 | s.spawn(task(core::ptr::null_mut()).unwrap()); |
| 16 | | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be sent between threads safely | 8 | | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be sent between threads safely |
| 17 | | | | 9 | | | |
| 18 | | required by a bound introduced by this call | 10 | | required by a bound introduced by this call |
| 19 | | | 11 | | |
| 20 | = help: within `impl Sized`, the trait `Send` is not implemented for `*mut ()` | 12 | = help: within `impl Sized`, the trait `Send` is not implemented for `*mut ()` |
| 21 | note: required because it's used within this closure | 13 | note: required because it's used within this closure |
| 22 | --> tests/ui/spawn_nonsend.rs:7:1 | 14 | --> tests/ui/spawn_nonsend.rs:5:1 |
| 23 | | | 15 | | |
| 24 | 7 | #[embassy_executor::task] | 16 | 5 | #[embassy_executor::task] |
| 25 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ | 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 26 | note: required because it appears within the type `impl Sized` | 18 | note: required because it appears within the type `impl Sized` |
| 27 | --> src/raw/mod.rs | 19 | --> src/raw/mod.rs |
| @@ -29,9 +21,9 @@ note: required because it appears within the type `impl Sized` | |||
| 29 | | pub unsafe fn _spawn_async_fn<FutFn>(&'static self, future: FutFn) -> Result<SpawnToken<impl Sized>, SpawnError> | 21 | | pub unsafe fn _spawn_async_fn<FutFn>(&'static self, future: FutFn) -> Result<SpawnToken<impl Sized>, SpawnError> |
| 30 | | ^^^^^^^^^^ | 22 | | ^^^^^^^^^^ |
| 31 | note: required because it appears within the type `impl Sized` | 23 | note: required because it appears within the type `impl Sized` |
| 32 | --> tests/ui/spawn_nonsend.rs:7:1 | 24 | --> tests/ui/spawn_nonsend.rs:5:1 |
| 33 | | | 25 | | |
| 34 | 7 | #[embassy_executor::task] | 26 | 5 | #[embassy_executor::task] |
| 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ | 27 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 36 | note: required by a bound in `SendSpawner::spawn` | 28 | note: required by a bound in `SendSpawner::spawn` |
| 37 | --> src/spawner.rs | 29 | --> src/spawner.rs |
diff --git a/embassy-executor/tests/ui/task_safety_attribute.rs b/embassy-executor/tests/ui/task_safety_attribute.rs index ab5a2f99f..46a5c665f 100644 --- a/embassy-executor/tests/ui/task_safety_attribute.rs +++ b/embassy-executor/tests/ui/task_safety_attribute.rs | |||
| @@ -9,7 +9,7 @@ async fn safe() {} | |||
| 9 | #[embassy_executor::task] | 9 | #[embassy_executor::task] |
| 10 | async unsafe fn not_safe() {} | 10 | async unsafe fn not_safe() {} |
| 11 | 11 | ||
| 12 | #[export_name = "__pender"] | 12 | #[unsafe(export_name = "__pender")] |
| 13 | fn pender(_: *mut ()) { | 13 | fn pender(_: *mut ()) { |
| 14 | // The test doesn't link if we don't include this. | 14 | // The test doesn't link if we don't include this. |
| 15 | // We never call this anyway. | 15 | // We never call this anyway. |
diff --git a/embassy-executor/tests/ui/unsafe_op_in_unsafe_task.stderr b/embassy-executor/tests/ui/unsafe_op_in_unsafe_task.stderr index d987a4b95..033395584 100644 --- a/embassy-executor/tests/ui/unsafe_op_in_unsafe_task.stderr +++ b/embassy-executor/tests/ui/unsafe_op_in_unsafe_task.stderr | |||
| @@ -4,7 +4,7 @@ error[E0133]: call to unsafe function `std::ptr::const_ptr::<impl *const T>::rea | |||
| 4 | 7 | (&x as *const i32).read(); | 4 | 7 | (&x as *const i32).read(); |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function |
| 6 | | | 6 | | |
| 7 | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html> | 7 | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html> |
| 8 | = note: consult the function's documentation for information on how to avoid undefined behavior | 8 | = note: consult the function's documentation for information on how to avoid undefined behavior |
| 9 | note: an unsafe function restricts its caller, but its body is safe by default | 9 | note: an unsafe function restricts its caller, but its body is safe by default |
| 10 | --> tests/ui/unsafe_op_in_unsafe_task.rs:5:1 | 10 | --> tests/ui/unsafe_op_in_unsafe_task.rs:5:1 |
