aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/unstable-features/trivial_bounds-feature-gate.rs
blob: f8467b082e5b42f04d0ae475d6efd15fbf624cb2 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Note: If you change this test, change 'trivial_bounds.rs' at the same time.

mod phantom_pinned {
    use std::marker::{PhantomData, PhantomPinned};

    struct A(PhantomPinned);

    impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277

    struct Wrapper<T>(T);

    impl<T> Unpin for Wrapper<T> where T: Unpin {}

    struct B(PhantomPinned);

    impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277

    struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);

    impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}

    struct C(PhantomPinned);

    impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {} // Ok
}

mod inner {
    use std::marker::{PhantomData, PhantomPinned};

    struct Inner(PhantomPinned);

    struct A(Inner);

    impl Unpin for A where Inner: Unpin {} //~ ERROR E0277

    struct Wrapper<T>(T);

    impl<T> Unpin for Wrapper<T> where T: Unpin {}

    struct B(Inner);

    impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277

    struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);

    impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}

    struct C(Inner);

    impl<'a> Unpin for C where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok
}

fn main() {}