aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/pin_project/remove-attr-from-struct.rs
blob: b395a423540c5307ee4fc59f1c9c3d5b020656cd (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
29
30
use auxiliary_macros::remove_attr;
use pin_project::pin_project;
use std::{marker::PhantomPinned, pin::Pin};

fn is_unpin<T: Unpin>() {}

#[pin_project]
#[remove_attr(struct)]
struct Foo {
    #[pin] //~ ERROR cannot find attribute `pin` in this scope
    field: PhantomPinned,
}

#[remove_attr(struct)]
#[pin_project]
struct Bar {
    #[pin] //~ ERROR cannot find attribute `pin` in this scope
    field: PhantomPinned,
}

fn main() {
    is_unpin::<Foo>(); //~ ERROR E0277
    is_unpin::<Bar>(); //~ ERROR E0277

    let mut x = Foo { field: PhantomPinned };
    let _x = Pin::new(&mut x).project(); //~ ERROR E0277,E0599

    let mut x = Bar { field: PhantomPinned };
    let _x = Pin::new(&mut x).project(); //~ ERROR E0277,E0599
}