1 // NB: If you change this test, change 'overlapping_marker_traits-feature-gate.rs' at the same time. 2 3 // This feature could break the guarantee for Unpin provided by pin-project, 4 // but was removed in https://github.com/rust-lang/rust/pull/68544 (nightly-2020-02-06). 5 // Refs: 6 // * https://github.com/rust-lang/rust/issues/29864#issuecomment-515780867. 7 // * https://github.com/taiki-e/pin-project/issues/105 8 9 // overlapping_marker_traits 10 // Tracking issue: https://github.com/rust-lang/rust/issues/29864 11 #![feature(overlapping_marker_traits)] 12 13 use pin_project::pin_project; 14 use std::marker::PhantomPinned; 15 16 #[pin_project] 17 struct Struct<T> { 18 #[pin] 19 x: T, 20 } 21 22 // unsound Unpin impl 23 impl<T> Unpin for Struct<T> {} 24 is_unpin<T: Unpin>()25fn is_unpin<T: Unpin>() {} 26 main()27fn main() { 28 is_unpin::<Struct<PhantomPinned>>() 29 } 30