diff options
| author | Brezak <[email protected]> | 2025-07-23 19:51:31 +0200 |
|---|---|---|
| committer | Brezak <[email protected]> | 2025-07-23 20:55:42 +0200 |
| commit | 539ff78ebbdedbb75d0faf940e3ee69f5e7f276a (patch) | |
| tree | 7096952c556d7262e59178e11f5d81753d08d12a /embassy-executor/tests | |
| parent | 1b42e624246f9355a91ef98ddf96d5af1b9b3687 (diff) | |
embassy-executor: explicitly return impl Future in task inner task
Diffstat (limited to 'embassy-executor/tests')
| -rw-r--r-- | embassy-executor/tests/test.rs | 11 | ||||
| -rw-r--r-- | embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/embassy-executor/tests/test.rs b/embassy-executor/tests/test.rs index c1e7ec5d7..b84d3785a 100644 --- a/embassy-executor/tests/test.rs +++ b/embassy-executor/tests/test.rs | |||
| @@ -7,7 +7,7 @@ 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; | 10 | use embassy_executor::{task, Spawner}; |
| 11 | 11 | ||
| 12 | #[export_name = "__pender"] | 12 | #[export_name = "__pender"] |
| 13 | fn __pender(context: *mut ()) { | 13 | fn __pender(context: *mut ()) { |
| @@ -317,3 +317,12 @@ fn executor_task_cfg_args() { | |||
| 317 | let (_, _, _) = (a, b, c); | 317 | let (_, _, _) = (a, b, c); |
| 318 | } | 318 | } |
| 319 | } | 319 | } |
| 320 | |||
| 321 | #[test] | ||
| 322 | fn recursive_task() { | ||
| 323 | #[embassy_executor::task(pool_size = 2)] | ||
| 324 | async fn task1() { | ||
| 325 | let spawner = unsafe { Spawner::for_current_executor().await }; | ||
| 326 | spawner.spawn(task1()); | ||
| 327 | } | ||
| 328 | } | ||
diff --git a/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr b/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr index 73ceb989d..3c3c9503b 100644 --- a/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr +++ b/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr | |||
| @@ -7,4 +7,4 @@ error[E0277]: task futures must resolve to `()` or `!` | |||
| 7 | = note: use `async fn` or change the return type to `impl Future<Output = ()>` | 7 | = note: use `async fn` or change the return type to `impl Future<Output = ()>` |
| 8 | = help: the following other types implement trait `TaskReturnValue`: | 8 | = help: the following other types implement trait `TaskReturnValue`: |
| 9 | () | 9 | () |
| 10 | <fn() -> ! as _export::HasOutput>::Output | 10 | <fn() -> ! as HasOutput>::Output |
