1 use std::{marker::PhantomPinned, pin::Pin}; 2 3 use auxiliary_macro::remove_attr; 4 use pin_project::pin_project; 5 is_unpin<T: Unpin>()6fn is_unpin<T: Unpin>() {} 7 8 #[pin_project] 9 #[remove_attr(struct_all)] 10 struct A { 11 #[pin] //~ ERROR cannot find attribute `pin` in this scope 12 f: PhantomPinned, 13 } 14 15 #[remove_attr(struct_all)] 16 #[pin_project] 17 struct B { 18 #[pin] //~ ERROR cannot find attribute `pin` in this scope 19 f: PhantomPinned, 20 } 21 22 #[pin_project] //~ ERROR has been removed 23 #[remove_attr(struct_pin)] 24 struct C { 25 f: PhantomPinned, 26 } 27 28 #[remove_attr(struct_pin)] 29 #[pin_project] // Ok 30 struct D { 31 f: PhantomPinned, 32 } 33 main()34fn main() { 35 is_unpin::<A>(); //~ ERROR E0277 36 is_unpin::<B>(); //~ ERROR E0277 37 is_unpin::<D>(); // Ok 38 39 let mut x = A { f: PhantomPinned }; 40 let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 41 42 let mut x = B { f: PhantomPinned }; 43 let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 44 45 let mut x = D { f: PhantomPinned }; 46 let _ = Pin::new(&mut x).project(); //~ Ok 47 } 48