Debian Codegraph @

third_party/rust/pin-project/tests/ui/unstable-features/overlapping_marker_traits.rs

raw
1 // Note: 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 std::marker::PhantomPinned;
14
15 use pin_project::pin_project;
16
17 #[pin_project]
18 struct Struct<T> {
19 #[pin]
20 f: T,
21 }
22
23 // unsound Unpin impl
24 impl<T> Unpin for Struct<T> {}
25
26 fn is_unpin<T: Unpin>() {}
27
28 fn main() {
29 is_unpin::<Struct<PhantomPinned>>()
30 }