mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-27 12:30:35 +00:00
Merge pull request #202 from kpp/fix_cfail
Fix cfail tests in const generics
This commit is contained in:
commit
5d294a700f
@ -1,7 +1,7 @@
|
||||
use heapless::{spsc::Queue};
|
||||
|
||||
fn main() {
|
||||
let mut q: Queue<u8, _, _, 4> = Queue::new();
|
||||
let mut q: Queue<u8, _, 4> = Queue::new();
|
||||
|
||||
let (_p, mut _c) = q.split();
|
||||
q.enqueue(0).unwrap();
|
||||
|
@ -1,13 +1,9 @@
|
||||
error[E0107]: this struct takes 3 generic arguments but 4 generic arguments were supplied
|
||||
--> $DIR/freeze.rs:4:16
|
||||
|
|
||||
4 | let mut q: Queue<u8, _, _, 4> = Queue::new();
|
||||
| ^^^^^ --- help: remove this generic argument
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: struct defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/mod.rs:151:12
|
||||
|
|
||||
151 | pub struct Queue<T, U, const N: usize>
|
||||
| ^^^^^ - - -
|
||||
error[E0499]: cannot borrow `q` as mutable more than once at a time
|
||||
--> $DIR/freeze.rs:7:5
|
||||
|
|
||||
6 | let (_p, mut _c) = q.split();
|
||||
| - first mutable borrow occurs here
|
||||
7 | q.enqueue(0).unwrap();
|
||||
| ^ second mutable borrow occurs here
|
||||
8 | _c.dequeue();
|
||||
| -- first borrow later used here
|
||||
|
@ -15,8 +15,8 @@ where
|
||||
}
|
||||
|
||||
fn main() {
|
||||
is_send::<Consumer<NotSend, _, _, 4>>();
|
||||
is_send::<Producer<NotSend, _, _, 4>>();
|
||||
is_send::<Queue<NotSend, _, _, 4>>();
|
||||
is_send::<Consumer<NotSend, _, 4>>();
|
||||
is_send::<Producer<NotSend, _, 4>>();
|
||||
is_send::<Queue<NotSend, _, 4>>();
|
||||
is_send::<heapless::Vec<NotSend, 4>>();
|
||||
}
|
||||
|
@ -1,44 +1,53 @@
|
||||
error[E0107]: this struct takes 3 generic arguments but 4 generic arguments were supplied
|
||||
--> $DIR/not-send.rs:18:15
|
||||
error[E0277]: `*const ()` cannot be sent between threads safely
|
||||
--> $DIR/not-send.rs:18:5
|
||||
|
|
||||
18 | is_send::<Consumer<NotSend, _, _, 4>>();
|
||||
| ^^^^^^^^ --- help: remove this generic argument
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
11 | fn is_send<T>()
|
||||
| ------- required by a bound in this
|
||||
12 | where
|
||||
13 | T: Send,
|
||||
| ---- required by this bound in `is_send`
|
||||
...
|
||||
18 | is_send::<Consumer<NotSend, _, 4>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
|
||||
|
|
||||
note: struct defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/split.rs:26:12
|
||||
|
|
||||
26 | pub struct Consumer<'a, T, U, const N: usize>
|
||||
| ^^^^^^^^ - - -
|
||||
= help: within `PhantomData<*const ()>`, the trait `Send` is not implemented for `*const ()`
|
||||
= note: required because it appears within the type `PhantomData<*const ()>`
|
||||
= note: required because of the requirements on the impl of `Send` for `Consumer<'_, PhantomData<*const ()>, _, 4_usize>`
|
||||
|
||||
error[E0107]: this struct takes 3 generic arguments but 4 generic arguments were supplied
|
||||
--> $DIR/not-send.rs:19:15
|
||||
error[E0277]: `*const ()` cannot be sent between threads safely
|
||||
--> $DIR/not-send.rs:19:5
|
||||
|
|
||||
19 | is_send::<Producer<NotSend, _, _, 4>>();
|
||||
| ^^^^^^^^ --- help: remove this generic argument
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
11 | fn is_send<T>()
|
||||
| ------- required by a bound in this
|
||||
12 | where
|
||||
13 | T: Send,
|
||||
| ---- required by this bound in `is_send`
|
||||
...
|
||||
19 | is_send::<Producer<NotSend, _, 4>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
|
||||
|
|
||||
note: struct defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/split.rs:43:12
|
||||
|
|
||||
43 | pub struct Producer<'a, T, U, const N: usize>
|
||||
| ^^^^^^^^ - - -
|
||||
= help: within `PhantomData<*const ()>`, the trait `Send` is not implemented for `*const ()`
|
||||
= note: required because it appears within the type `PhantomData<*const ()>`
|
||||
= note: required because of the requirements on the impl of `Send` for `Producer<'_, PhantomData<*const ()>, _, 4_usize>`
|
||||
|
||||
error[E0107]: this struct takes 3 generic arguments but 4 generic arguments were supplied
|
||||
--> $DIR/not-send.rs:20:15
|
||||
|
|
||||
20 | is_send::<Queue<NotSend, _, _, 4>>();
|
||||
| ^^^^^ --- help: remove this generic argument
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: struct defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/mod.rs:151:12
|
||||
|
|
||||
151 | pub struct Queue<T, U, const N: usize>
|
||||
| ^^^^^ - - -
|
||||
error[E0277]: `*const ()` cannot be sent between threads safely
|
||||
--> $DIR/not-send.rs:20:5
|
||||
|
|
||||
11 | fn is_send<T>()
|
||||
| ------- required by a bound in this
|
||||
12 | where
|
||||
13 | T: Send,
|
||||
| ---- required by this bound in `is_send`
|
||||
...
|
||||
20 | is_send::<Queue<NotSend, _, 4>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
|
||||
|
|
||||
= help: within `Queue<PhantomData<*const ()>, _, 4_usize>`, the trait `Send` is not implemented for `*const ()`
|
||||
= note: required because it appears within the type `PhantomData<*const ()>`
|
||||
= note: required because it appears within the type `[PhantomData<*const ()>; 4]`
|
||||
= note: required because it appears within the type `ManuallyDrop<[PhantomData<*const ()>; 4]>`
|
||||
= note: required because it appears within the type `MaybeUninit<[PhantomData<*const ()>; 4]>`
|
||||
= note: required because it appears within the type `Queue<PhantomData<*const ()>, _, 4_usize>`
|
||||
|
||||
error[E0277]: `*const ()` cannot be sent between threads safely
|
||||
--> $DIR/not-send.rs:21:5
|
||||
|
Loading…
x
Reference in New Issue
Block a user