aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-executor/Cargo.toml1
-rw-r--r--embassy-executor/tests/ui.rs13
-rw-r--r--embassy-executor/tests/ui/bad_return_impl_future.rs (renamed from embassy-executor/tests/ui/bad_return_impl_trait.rs)0
-rw-r--r--embassy-executor/tests/ui/bad_return_impl_future.stderr (renamed from embassy-executor/tests/ui/bad_return_impl_trait.stderr)30
-rw-r--r--embassy-executor/tests/ui/bad_return_impl_future_nightly.rs (renamed from embassy-executor/tests/ui/bad_return_impl_trait_nightly.rs)0
-rw-r--r--embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr (renamed from embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr)2
-rw-r--r--embassy-executor/tests/ui/return_impl_send.rs6
-rw-r--r--embassy-executor/tests/ui/return_impl_send.stderr137
-rw-r--r--embassy-executor/tests/ui/return_impl_send_nightly.rs6
-rw-r--r--embassy-executor/tests/ui/return_impl_send_nightly.stderr10
10 files changed, 185 insertions, 20 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index f014ccf30..2dbf2c29a 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -59,6 +59,7 @@ avr-device = { version = "0.7.0", optional = true }
59critical-section = { version = "1.1", features = ["std"] } 59critical-section = { version = "1.1", features = ["std"] }
60trybuild = "1.0" 60trybuild = "1.0"
61embassy-sync = { path = "../embassy-sync" } 61embassy-sync = { path = "../embassy-sync" }
62rustversion = "1.0.21"
62 63
63[features] 64[features]
64 65
diff --git a/embassy-executor/tests/ui.rs b/embassy-executor/tests/ui.rs
index ed8228e27..c4a1a601c 100644
--- a/embassy-executor/tests/ui.rs
+++ b/embassy-executor/tests/ui.rs
@@ -17,10 +17,15 @@ fn ui() {
17 t.compile_fail("tests/ui/nonstatic_struct_elided.rs"); 17 t.compile_fail("tests/ui/nonstatic_struct_elided.rs");
18 t.compile_fail("tests/ui/nonstatic_struct_generic.rs"); 18 t.compile_fail("tests/ui/nonstatic_struct_generic.rs");
19 t.compile_fail("tests/ui/not_async.rs"); 19 t.compile_fail("tests/ui/not_async.rs");
20 // #[cfg(not(feature = "nightly"))] // output differs on stable and nightly 20 if rustversion::cfg!(stable) {
21 // t.compile_fail("tests/ui/bad_return_impl_trait.rs"); 21 // output is slightly different on nightly
22 #[cfg(feature = "nightly")] 22 t.compile_fail("tests/ui/bad_return_impl_future.rs");
23 t.compile_fail("tests/ui/bad_return_impl_trait_nightly.rs"); 23 t.compile_fail("tests/ui/return_impl_send.rs");
24 }
25 if cfg!(feature = "nightly") {
26 t.compile_fail("tests/ui/bad_return_impl_future_nightly.rs");
27 t.compile_fail("tests/ui/return_impl_send_nightly.rs");
28 }
24 t.compile_fail("tests/ui/self_ref.rs"); 29 t.compile_fail("tests/ui/self_ref.rs");
25 t.compile_fail("tests/ui/self.rs"); 30 t.compile_fail("tests/ui/self.rs");
26 t.compile_fail("tests/ui/type_error.rs"); 31 t.compile_fail("tests/ui/type_error.rs");
diff --git a/embassy-executor/tests/ui/bad_return_impl_trait.rs b/embassy-executor/tests/ui/bad_return_impl_future.rs
index baaa7dc5a..baaa7dc5a 100644
--- a/embassy-executor/tests/ui/bad_return_impl_trait.rs
+++ b/embassy-executor/tests/ui/bad_return_impl_future.rs
diff --git a/embassy-executor/tests/ui/bad_return_impl_trait.stderr b/embassy-executor/tests/ui/bad_return_impl_future.stderr
index 9e2df353e..2980fd18b 100644
--- a/embassy-executor/tests/ui/bad_return_impl_trait.stderr
+++ b/embassy-executor/tests/ui/bad_return_impl_future.stderr
@@ -1,5 +1,5 @@
1error[E0277]: task function futures must resolve to `()` 1error[E0277]: task futures must resolve to `()` or `!`
2 --> tests/ui/bad_return_impl_trait.rs:5:4 2 --> tests/ui/bad_return_impl_future.rs:5:4
3 | 3 |
44 | #[embassy_executor::task] 44 | #[embassy_executor::task]
5 | ------------------------- required by a bound introduced by this call 5 | ------------------------- required by a bound introduced by this call
@@ -16,8 +16,8 @@ note: required by a bound in `task_pool_size`
16 | F: TaskFn<Args, Fut = Fut>, 16 | F: TaskFn<Args, Fut = Fut>,
17 | ^^^^^^^^^ required by this bound in `task_pool_size` 17 | ^^^^^^^^^ required by this bound in `task_pool_size`
18 18
19error[E0277]: task function futures must resolve to `()` 19error[E0277]: task futures must resolve to `()` or `!`
20 --> tests/ui/bad_return_impl_trait.rs:4:1 20 --> tests/ui/bad_return_impl_future.rs:4:1
21 | 21 |
224 | #[embassy_executor::task] 224 | #[embassy_executor::task]
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future<Output = u32> {__task_task}` 23 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future<Output = u32> {__task_task}`
@@ -33,8 +33,8 @@ note: required by a bound in `task_pool_size`
33 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_size` 33 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_size`
34 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) 34 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
35 35
36error[E0277]: task function futures must resolve to `()` 36error[E0277]: task futures must resolve to `()` or `!`
37 --> tests/ui/bad_return_impl_trait.rs:5:4 37 --> tests/ui/bad_return_impl_future.rs:5:4
38 | 38 |
394 | #[embassy_executor::task] 394 | #[embassy_executor::task]
40 | ------------------------- required by a bound introduced by this call 40 | ------------------------- required by a bound introduced by this call
@@ -51,8 +51,8 @@ note: required by a bound in `task_pool_align`
51 | F: TaskFn<Args, Fut = Fut>, 51 | F: TaskFn<Args, Fut = Fut>,
52 | ^^^^^^^^^ required by this bound in `task_pool_align` 52 | ^^^^^^^^^ required by this bound in `task_pool_align`
53 53
54error[E0277]: task function futures must resolve to `()` 54error[E0277]: task futures must resolve to `()` or `!`
55 --> tests/ui/bad_return_impl_trait.rs:4:1 55 --> tests/ui/bad_return_impl_future.rs:4:1
56 | 56 |
574 | #[embassy_executor::task] 574 | #[embassy_executor::task]
58 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future<Output = u32> {__task_task}` 58 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future<Output = u32> {__task_task}`
@@ -68,8 +68,8 @@ note: required by a bound in `task_pool_align`
68 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_align` 68 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_align`
69 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) 69 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
70 70
71error[E0277]: task function futures must resolve to `()` 71error[E0277]: task futures must resolve to `()` or `!`
72 --> tests/ui/bad_return_impl_trait.rs:5:4 72 --> tests/ui/bad_return_impl_future.rs:5:4
73 | 73 |
744 | #[embassy_executor::task] 744 | #[embassy_executor::task]
75 | ------------------------- required by a bound introduced by this call 75 | ------------------------- required by a bound introduced by this call
@@ -86,8 +86,8 @@ note: required by a bound in `task_pool_new`
86 | F: TaskFn<Args, Fut = Fut>, 86 | F: TaskFn<Args, Fut = Fut>,
87 | ^^^^^^^^^ required by this bound in `task_pool_new` 87 | ^^^^^^^^^ required by this bound in `task_pool_new`
88 88
89error[E0277]: task function futures must resolve to `()` 89error[E0277]: task futures must resolve to `()` or `!`
90 --> tests/ui/bad_return_impl_trait.rs:4:1 90 --> tests/ui/bad_return_impl_future.rs:4:1
91 | 91 |
924 | #[embassy_executor::task] 924 | #[embassy_executor::task]
93 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future<Output = u32> {__task_task}` 93 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future<Output = u32> {__task_task}`
@@ -103,8 +103,8 @@ note: required by a bound in `task_pool_new`
103 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_new` 103 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_new`
104 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) 104 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
105 105
106error[E0277]: task function futures must resolve to `()` 106error[E0277]: task futures must resolve to `()` or `!`
107 --> tests/ui/bad_return_impl_trait.rs:5:4 107 --> tests/ui/bad_return_impl_future.rs:5:4
108 | 108 |
1094 | #[embassy_executor::task] 1094 | #[embassy_executor::task]
110 | ------------------------- required by a bound introduced by this call 110 | ------------------------- required by a bound introduced by this call
@@ -113,7 +113,7 @@ error[E0277]: task function futures must resolve to `()`
113 | 113 |
114 = note: use `async fn` or change the return type to `impl Future<Output = ()>` 114 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
115note: required by a bound in `__task_pool_get` 115note: required by a bound in `__task_pool_get`
116 --> tests/ui/bad_return_impl_trait.rs:4:1 116 --> tests/ui/bad_return_impl_future.rs:4:1
117 | 117 |
1184 | #[embassy_executor::task] 1184 | #[embassy_executor::task]
119 | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__task_pool_get` 119 | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__task_pool_get`
diff --git a/embassy-executor/tests/ui/bad_return_impl_trait_nightly.rs b/embassy-executor/tests/ui/bad_return_impl_future_nightly.rs
index baaa7dc5a..baaa7dc5a 100644
--- a/embassy-executor/tests/ui/bad_return_impl_trait_nightly.rs
+++ b/embassy-executor/tests/ui/bad_return_impl_future_nightly.rs
diff --git a/embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr b/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr
index a51251bb8..73ceb989d 100644
--- a/embassy-executor/tests/ui/bad_return_impl_trait_nightly.stderr
+++ b/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr
@@ -1,5 +1,5 @@
1error[E0277]: task futures must resolve to `()` or `!` 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_future_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`
diff --git a/embassy-executor/tests/ui/return_impl_send.rs b/embassy-executor/tests/ui/return_impl_send.rs
new file mode 100644
index 000000000..6ddb0e722
--- /dev/null
+++ b/embassy-executor/tests/ui/return_impl_send.rs
@@ -0,0 +1,6 @@
1#![cfg_attr(feature = "nightly", feature(impl_trait_in_assoc_type))]
2
3#[embassy_executor::task]
4fn task() -> impl Send {}
5
6fn main() {}
diff --git a/embassy-executor/tests/ui/return_impl_send.stderr b/embassy-executor/tests/ui/return_impl_send.stderr
new file mode 100644
index 000000000..7e3e468b8
--- /dev/null
+++ b/embassy-executor/tests/ui/return_impl_send.stderr
@@ -0,0 +1,137 @@
1error[E0277]: task futures must resolve to `()` or `!`
2 --> tests/ui/return_impl_send.rs:4:4
3 |
43 | #[embassy_executor::task]
5 | ------------------------- required by a bound introduced by this call
64 | fn task() -> impl Send {}
7 | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}`
8 |
9 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
10note: required by a bound in `task_pool_size`
11 --> src/lib.rs
12 |
13 | pub const fn task_pool_size<F, Args, Fut, const POOL_SIZE: usize>(_: F) -> usize
14 | -------------- required by a bound in this function
15 | where
16 | F: TaskFn<Args, Fut = Fut>,
17 | ^^^^^^^^^ required by this bound in `task_pool_size`
18
19error[E0277]: task futures must resolve to `()` or `!`
20 --> tests/ui/return_impl_send.rs:3:1
21 |
223 | #[embassy_executor::task]
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}`
24 |
25 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
26note: required by a bound in `task_pool_size`
27 --> src/lib.rs
28 |
29 | pub const fn task_pool_size<F, Args, Fut, const POOL_SIZE: usize>(_: F) -> usize
30 | -------------- required by a bound in this function
31 | where
32 | F: TaskFn<Args, Fut = Fut>,
33 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_size`
34 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
35
36error[E0277]: task futures must resolve to `()` or `!`
37 --> tests/ui/return_impl_send.rs:4:4
38 |
393 | #[embassy_executor::task]
40 | ------------------------- required by a bound introduced by this call
414 | fn task() -> impl Send {}
42 | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}`
43 |
44 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
45note: required by a bound in `task_pool_align`
46 --> src/lib.rs
47 |
48 | pub const fn task_pool_align<F, Args, Fut, const POOL_SIZE: usize>(_: F) -> usize
49 | --------------- required by a bound in this function
50 | where
51 | F: TaskFn<Args, Fut = Fut>,
52 | ^^^^^^^^^ required by this bound in `task_pool_align`
53
54error[E0277]: task futures must resolve to `()` or `!`
55 --> tests/ui/return_impl_send.rs:3:1
56 |
573 | #[embassy_executor::task]
58 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}`
59 |
60 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
61note: required by a bound in `task_pool_align`
62 --> src/lib.rs
63 |
64 | pub const fn task_pool_align<F, Args, Fut, const POOL_SIZE: usize>(_: F) -> usize
65 | --------------- required by a bound in this function
66 | where
67 | F: TaskFn<Args, Fut = Fut>,
68 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_align`
69 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
70
71error[E0277]: task futures must resolve to `()` or `!`
72 --> tests/ui/return_impl_send.rs:4:4
73 |
743 | #[embassy_executor::task]
75 | ------------------------- required by a bound introduced by this call
764 | fn task() -> impl Send {}
77 | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}`
78 |
79 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
80note: required by a bound in `task_pool_new`
81 --> src/lib.rs
82 |
83 | pub const fn task_pool_new<F, Args, Fut, const POOL_SIZE: usize>(_: F) -> TaskPool<Fut, POOL_SIZE>
84 | ------------- required by a bound in this function
85 | where
86 | F: TaskFn<Args, Fut = Fut>,
87 | ^^^^^^^^^ required by this bound in `task_pool_new`
88
89error[E0277]: task futures must resolve to `()` or `!`
90 --> tests/ui/return_impl_send.rs:3:1
91 |
923 | #[embassy_executor::task]
93 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}`
94 |
95 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
96note: required by a bound in `task_pool_new`
97 --> src/lib.rs
98 |
99 | pub const fn task_pool_new<F, Args, Fut, const POOL_SIZE: usize>(_: F) -> TaskPool<Fut, POOL_SIZE>
100 | ------------- required by a bound in this function
101 | where
102 | F: TaskFn<Args, Fut = Fut>,
103 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_new`
104 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
105
106error[E0277]: task futures must resolve to `()` or `!`
107 --> tests/ui/return_impl_send.rs:4:4
108 |
1093 | #[embassy_executor::task]
110 | ------------------------- required by a bound introduced by this call
1114 | fn task() -> impl Send {}
112 | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}`
113 |
114 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
115note: required by a bound in `__task_pool_get`
116 --> tests/ui/return_impl_send.rs:3:1
117 |
1183 | #[embassy_executor::task]
119 | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__task_pool_get`
120 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
121
122error[E0277]: `impl Send` is not a future
123 --> tests/ui/return_impl_send.rs:3:1
124 |
1253 | #[embassy_executor::task]
126 | ^^^^^^^^^^^^^^^^^^^^^^^^^ `impl Send` is not a future
127 |
128 = help: the trait `Future` is not implemented for `impl Send`
129note: required by a bound in `TaskPool::<F, N>::_spawn_async_fn`
130 --> src/raw/mod.rs
131 |
132 | impl<F: Future + 'static, const N: usize> TaskPool<F, N> {
133 | ^^^^^^ required by this bound in `TaskPool::<F, N>::_spawn_async_fn`
134...
135 | pub unsafe fn _spawn_async_fn<FutFn>(&'static self, future: FutFn) -> SpawnToken<impl Sized>
136 | --------------- required by a bound in this associated function
137 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/embassy-executor/tests/ui/return_impl_send_nightly.rs b/embassy-executor/tests/ui/return_impl_send_nightly.rs
new file mode 100644
index 000000000..6ddb0e722
--- /dev/null
+++ b/embassy-executor/tests/ui/return_impl_send_nightly.rs
@@ -0,0 +1,6 @@
1#![cfg_attr(feature = "nightly", feature(impl_trait_in_assoc_type))]
2
3#[embassy_executor::task]
4fn task() -> impl Send {}
5
6fn main() {}
diff --git a/embassy-executor/tests/ui/return_impl_send_nightly.stderr b/embassy-executor/tests/ui/return_impl_send_nightly.stderr
new file mode 100644
index 000000000..de9ba6243
--- /dev/null
+++ b/embassy-executor/tests/ui/return_impl_send_nightly.stderr
@@ -0,0 +1,10 @@
1error[E0277]: `impl Send` is not a future
2 --> tests/ui/return_impl_send_nightly.rs:3:1
3 |
43 | #[embassy_executor::task]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^
6 | |
7 | `impl Send` is not a future
8 | return type was inferred to be `impl Send` here
9 |
10 = help: the trait `Future` is not implemented for `impl Send`