aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/pinned_drop/self.rs
blob: cd53b0428ccde04e62a0820cd84d2b52107eb3af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;

fn self_in_macro_def() {
    #[pin_project(PinnedDrop)]
    pub struct Struct {
        x: usize,
    }

    #[pinned_drop]
    impl PinnedDrop for Struct {
        fn drop(self: Pin<&mut Self>) {
            macro_rules! t {
                () => {{
                    let _ = self; //~ ERROR can't capture dynamic environment in a fn item

                    fn f(self: ()) {
                        //~^ ERROR `self` parameter is only allowed in associated functions
                        let _ = self;
                    }
                }};
            }
            t!();
        }
    }
}

fn main() {}