• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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()10 fn inner() {
11     struct Inner(PhantomPinned);
12 
13     struct A(Inner);
14 
15     impl Unpin for A where Inner: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters
16 
17     struct Wrapper<T>(T);
18 
19     impl<T> Unpin for Wrapper<T> where T: Unpin {}
20 
21     struct B(Inner);
22 
23     impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters
24 
25     struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
26 
27     impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
28 
29     struct C(Inner);
30 
31     impl<'a> Unpin for C where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok
32 }
33 
main()34 fn main() {}
35