diff options
Diffstat (limited to 'tests/ui/unstable-features/negative_impls.rs')
-rw-r--r-- | tests/ui/unstable-features/negative_impls.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/unstable-features/negative_impls.rs b/tests/ui/unstable-features/negative_impls.rs new file mode 100644 index 0000000..9605642 --- /dev/null +++ b/tests/ui/unstable-features/negative_impls.rs @@ -0,0 +1,23 @@ +#![feature(negative_impls)] +#![deny(suspicious_auto_trait_impls)] + +// https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/design.20meeting.3A.20backlog.20bonanza/near/269471299 +// https://github.com/taiki-e/pin-project/issues/340 + +#[pin_project::pin_project] +struct Foo<Pinned, Unpinned> { + #[pin] + pinned: Pinned, + + unpinned: Unpinned, +} + +struct MyPhantomPinned {} +impl !Unpin for MyPhantomPinned {} +impl Unpin for Foo<MyPhantomPinned, ()> {} + +fn is_unpin<T: Unpin>() {} + +fn main() { + is_unpin::<Foo<MyPhantomPinned, ()>>() +} |