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 #![deny(trivial_bounds)] 7 8 use std::marker::{PhantomData, PhantomPinned}; 9 inner()10fn inner() { 11 struct Inner(PhantomPinned); 12 13 struct A(PhantomPinned); 14 15 impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters 16 17 struct B(Inner); 18 19 impl Unpin for B where Inner: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters 20 21 struct Wrapper<T>(T); 22 23 impl<T> Unpin for Wrapper<T> where T: Unpin {} 24 25 struct C(Inner); 26 27 impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters 28 29 struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T); 30 31 impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {} 32 33 struct D(Inner); 34 35 impl<'a> Unpin for D where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok 36 } 37 main()38fn main() {} 39