1 use auxiliary_macro::remove_attr; 2 use pin_project::pin_project; 3 use std::{marker::PhantomPinned, pin::Pin}; 4 is_unpin<T: Unpin>()5fn is_unpin<T: Unpin>() {} 6 7 #[pin_project] 8 #[remove_attr(field_all)] 9 struct A { 10 #[pin] 11 f: PhantomPinned, 12 } 13 14 #[remove_attr(field_all)] 15 #[pin_project] 16 struct B { 17 #[pin] 18 f: PhantomPinned, 19 } 20 main()21fn main() { 22 is_unpin::<A>(); 23 is_unpin::<B>(); 24 25 let mut x = A { f: PhantomPinned }; 26 let x = Pin::new(&mut x).project(); 27 let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 28 29 let mut x = B { f: PhantomPinned }; 30 let x = Pin::new(&mut x).project(); 31 let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 32 } 33