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