1 pub mod self_in_macro_def { 2 use pin_project::{pin_project, pinned_drop}; 3 use std::pin::Pin; 4 5 #[pin_project(PinnedDrop)] 6 pub struct S { 7 f: (), 8 } 9 10 #[pinned_drop] 11 impl PinnedDrop for S { drop(self: Pin<&mut Self>)12 fn drop(self: Pin<&mut Self>) { 13 macro_rules! t { 14 () => {{ 15 let _ = self; //~ ERROR E0434 16 17 fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions 18 }}; 19 } 20 t!(); 21 } 22 } 23 } 24 25 pub mod self_span { 26 use pin_project::{pin_project, pinned_drop}; 27 use std::pin::Pin; 28 29 #[pin_project(PinnedDrop)] 30 pub struct S { 31 f: (), 32 } 33 34 #[pinned_drop] 35 impl PinnedDrop for S { drop(self: Pin<&mut Self>)36 fn drop(self: Pin<&mut Self>) { 37 let _: () = self; //~ ERROR E0308 38 let _: Self = Self; //~ ERROR E0423 39 } 40 } 41 42 #[pin_project(PinnedDrop)] 43 pub enum E { 44 V { f: () }, 45 } 46 47 #[pinned_drop] 48 impl PinnedDrop for E { drop(self: Pin<&mut Self>)49 fn drop(self: Pin<&mut Self>) { 50 let _: () = self; //~ ERROR E0308 51 let _: Self = Self::V; //~ ERROR E0533 52 } 53 } 54 } 55 main()56fn main() {} 57