• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: Apache-2.0 OR MIT
2 
3 // https://github.com/taiki-e/pin-project/issues/340#issuecomment-2428002670
4 
5 #[pin_project::pin_project(UnsafeUnpin)]
6 struct Foo<Pinned, Unpinned> {
7     #[pin]
8     pinned: Pinned,
9     unpinned: Unpinned,
10 }
11 
12 unsafe impl<Pinned: Unpin, Unpinned> pin_project::UnsafeUnpin for Foo<Pinned, Unpinned> {}
13 
14 struct MyPhantomPinned(::core::marker::PhantomPinned);
15 impl Unpin for MyPhantomPinned where for<'cursed> str: Sized {}
16 impl Unpin for Foo<MyPhantomPinned, ()> {}
17 
is_unpin<T: Unpin>()18 fn is_unpin<T: Unpin>() {}
19 
main()20 fn main() {
21     is_unpin::<Foo<MyPhantomPinned, ()>>()
22 }
23