Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#![feature(negative_impls)] breaks the guarantee for Unpin provided by pin-project #340

Open
taiki-e opened this issue Jan 30, 2022 · 1 comment
Labels
A-unpin Area: Unpin and UnsafeUnpin C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) I-unsound A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness requires-nightly This issue requires a nightly compiler in some way

Comments

@taiki-e
Copy link
Owner

taiki-e commented Jan 30, 2022

pin-project provides an appropriate Unpin implementation by default. Since overlapping implementations are prohibited, this ensures that users cannot add inappropriate Unpin implementations.

However, currently, this guarantee can be broken by using #[feature(negative_impls)]: playground

Thanks @danielhenrymantilla for pointing out the interaction with this feature.

@taiki-e taiki-e added C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) A-unpin Area: Unpin and UnsafeUnpin I-unsound A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness requires-nightly This issue requires a nightly compiler in some way labels Jan 30, 2022
taiki-e added a commit that referenced this issue Jan 30, 2022
bors bot added a commit that referenced this issue Jan 30, 2022
341: Add test for #340 r=taiki-e a=taiki-e

Add test for #340

Co-authored-by: Taiki Endo <te316e89@gmail.com>
@taiki-e
Copy link
Owner Author

taiki-e commented Jun 30, 2022

It seems that a warning that catches this has been implemented.

error: cross-crate traits with a default impl, like `Unpin`, should not be specialized
  --> tests/run-pass/negative_impls.rs:16:1
   |
16 | impl Unpin for Foo<MyPhantomPinned, ()> {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D suspicious-auto-trait-impls` implied by `-D warnings`
   = warning: this will change its meaning in a future release!
   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
   = note: `MyPhantomPinned` is not a generic parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-unpin Area: Unpin and UnsafeUnpin C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) I-unsound A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness requires-nightly This issue requires a nightly compiler in some way
Projects
None yet
Development

No branches or pull requests

1 participant