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
33
34
35
36
37
38
39
40
41
|
use pin_project_lite::pin_project;
use std::marker::PhantomPinned;
struct Inner<T> {
val: T,
}
pin_project! {
struct Foo<T, U> {
#[pin]
inner: Inner<T>,
other: U,
}
}
pin_project! {
pub struct TrivialBounds {
#[pin]
field1: PhantomPinned,
}
}
pin_project! {
struct Bar<'a, T, U> {
#[pin]
inner: &'a mut Inner<T>,
other: U,
}
}
fn is_unpin<T: Unpin>() {}
fn main() {
is_unpin::<Foo<PhantomPinned, ()>>(); //~ ERROR E0277
is_unpin::<Foo<(), PhantomPinned>>(); // Ok
is_unpin::<Foo<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277
is_unpin::<TrivialBounds>(); //~ ERROR E0277
is_unpin::<Bar<'_, PhantomPinned, PhantomPinned>>(); //~ Ok
}
|