diff options
| -rw-r--r-- | embassy-executor/src/lib.rs | 4 | ||||
| -rw-r--r-- | embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs index e26e8ee7d..e174a0594 100644 --- a/embassy-executor/src/lib.rs +++ b/embassy-executor/src/lib.rs | |||
| @@ -233,6 +233,10 @@ pub mod _export { | |||
| 233 | #[doc(hidden)] | 233 | #[doc(hidden)] |
| 234 | #[cfg(feature = "nightly")] | 234 | #[cfg(feature = "nightly")] |
| 235 | pub mod _export { | 235 | pub mod _export { |
| 236 | #[diagnostic::on_unimplemented( | ||
| 237 | message = "task futures must resolve to `()` or `!`", | ||
| 238 | note = "use `async fn` or change the return type to `impl Future<Output = ()>`" | ||
| 239 | )] | ||
| 236 | pub trait TaskReturnValue {} | 240 | pub trait TaskReturnValue {} |
| 237 | impl TaskReturnValue for () {} | 241 | impl TaskReturnValue for () {} |
| 238 | impl TaskReturnValue for Never {} | 242 | impl TaskReturnValue for Never {} |
diff --git a/embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr b/embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr index 21e20d5c0..a51251bb8 100644 --- a/embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr +++ b/embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | error[E0277]: the trait bound `u32: TaskReturnValue` is not satisfied | 1 | error[E0277]: task futures must resolve to `()` or `!` |
| 2 | --> tests/ui/bad_return_impl_trait_nightly.rs:4:1 | 2 | --> tests/ui/bad_return_impl_trait_nightly.rs:4:1 |
| 3 | | | 3 | | |
| 4 | 4 | #[embassy_executor::task] | 4 | 4 | #[embassy_executor::task] |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskReturnValue` is not implemented for `u32` | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskReturnValue` is not implemented for `u32` |
| 6 | | | 6 | | |
| 7 | = note: use `async fn` or change the return type to `impl Future<Output = ()>` | ||
| 7 | = help: the following other types implement trait `TaskReturnValue`: | 8 | = help: the following other types implement trait `TaskReturnValue`: |
| 8 | () | 9 | () |
| 9 | <fn() -> ! as _export::HasOutput>::Output | 10 | <fn() -> ! as _export::HasOutput>::Output |
