1 // Note: If you change this test, change 'trivial_bounds-feature-gate.rs' at the same time. 2 3 // trivial_bounds 4 // Tracking issue: https://github.com/rust-lang/rust/issues/48214 5 #![feature(trivial_bounds)] 6 7 mod phantom_pinned { 8 use std::marker::{PhantomData, PhantomPinned}; 9 10 struct A(PhantomPinned); 11 12 // bug of trivial_bounds? 13 impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 14 15 struct Wrapper<T>(T); 16 17 impl<T> Unpin for Wrapper<T> where T: Unpin {} 18 19 struct B(PhantomPinned); 20 21 impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} // Ok 22 23 struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T); 24 25 impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {} 26 27 struct C(PhantomPinned); 28 29 // Ok 30 impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {} 31 } 32 main()33fn main() {} 34