diff options
Diffstat (limited to 'tests/ui/pin_project/remove-attr-from-struct.rs')
-rw-r--r-- | tests/ui/pin_project/remove-attr-from-struct.rs | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/tests/ui/pin_project/remove-attr-from-struct.rs b/tests/ui/pin_project/remove-attr-from-struct.rs index b395a42..0c7af63 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.rs +++ b/tests/ui/pin_project/remove-attr-from-struct.rs @@ -5,26 +5,42 @@ use std::{marker::PhantomPinned, pin::Pin}; fn is_unpin<T: Unpin>() {} #[pin_project] -#[remove_attr(struct)] -struct Foo { +#[remove_attr(struct_all)] +struct A { #[pin] //~ ERROR cannot find attribute `pin` in this scope field: PhantomPinned, } -#[remove_attr(struct)] +#[remove_attr(struct_all)] #[pin_project] -struct Bar { +struct B { #[pin] //~ ERROR cannot find attribute `pin` in this scope field: PhantomPinned, } +#[pin_project] //~ ERROR has been removed +#[remove_attr(struct_pin)] +struct C { + field: PhantomPinned, +} + +#[remove_attr(struct_pin)] +#[pin_project] // Ok +struct D { + field: PhantomPinned, +} + fn main() { - is_unpin::<Foo>(); //~ ERROR E0277 - is_unpin::<Bar>(); //~ ERROR E0277 + is_unpin::<A>(); //~ ERROR E0277 + is_unpin::<B>(); //~ ERROR E0277 + is_unpin::<D>(); // Ok + + let mut x = A { field: PhantomPinned }; + let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - let mut x = Foo { field: PhantomPinned }; - let _x = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 + let mut x = B { field: PhantomPinned }; + let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - let mut x = Bar { field: PhantomPinned }; - let _x = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 + let mut x = D { field: PhantomPinned }; + let _ = Pin::new(&mut x).project(); //~ Ok } |