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