aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor
diff options
context:
space:
mode:
authorMatthew Tran <[email protected]>2025-06-01 10:32:24 -0500
committerMatthew Tran <[email protected]>2025-06-01 10:32:24 -0500
commit0d83fbbb57cf17186a1b8f40f57ef7a35b3e9627 (patch)
tree77b20ca5cb38324dd69d77bb1761ef6f9217008e /embassy-executor
parentb06a708f81d208236763a121797807fd5b48aee6 (diff)
Add diagnostic::on_unimplemented for nightly
Diffstat (limited to 'embassy-executor')
-rw-r--r--embassy-executor/src/lib.rs4
-rw-r--r--embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr3
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")]
235pub mod _export { 235pub 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 @@
1error[E0277]: the trait bound `u32: TaskReturnValue` is not satisfied 1error[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 |
44 | #[embassy_executor::task] 44 | #[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