blob: eebd3cd27fe5c40c62e85078f9381292ba0ec799 (
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
31
32
|
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(field)]
struct Foo {
#[pin]
field: PhantomPinned,
}
#[remove_attr(field)]
#[pin_project]
struct Bar {
#[pin]
field: PhantomPinned,
}
fn main() {
is_unpin::<Foo>();
is_unpin::<Bar>();
let mut x = Foo { field: PhantomPinned };
let x = Pin::new(&mut x).project();
let _: Pin<&mut PhantomPinned> = x.field; //~ ERROR E0308
let mut x = Bar { field: PhantomPinned };
let x = Pin::new(&mut x).project();
let _: Pin<&mut PhantomPinned> = x.field; //~ ERROR E0308
}
|