• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Note: If you change this test, change 'trivial_bounds.rs' at the same time.
2 
3 mod phantom_pinned {
4     use std::marker::{PhantomData, PhantomPinned};
5 
6     struct A(PhantomPinned);
7 
8     impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277
9 
10     struct Wrapper<T>(T);
11 
12     impl<T> Unpin for Wrapper<T> where T: Unpin {}
13 
14     struct B(PhantomPinned);
15 
16     impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277
17 
18     struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
19 
20     impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
21 
22     struct C(PhantomPinned);
23 
24     impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {} // Ok
25 }
26 
27 mod inner {
28     use std::marker::{PhantomData, PhantomPinned};
29 
30     struct Inner(PhantomPinned);
31 
32     struct A(Inner);
33 
34     impl Unpin for A where Inner: Unpin {} //~ ERROR E0277
35 
36     struct Wrapper<T>(T);
37 
38     impl<T> Unpin for Wrapper<T> where T: Unpin {}
39 
40     struct B(Inner);
41 
42     impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277
43 
44     struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
45 
46     impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
47 
48     struct C(Inner);
49 
50     impl<'a> Unpin for C where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok
51 }
52 
main()53 fn main() {}
54