You can implement `UnsafeUnpinned` yourself
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
#![feature(unsafe_unpin)]
struct Foo(std::marker::PhantomPinned);
unsafe impl std::marker::UnsafeUnpin for Foo {}
I expected to see this happen: the code does not compile. The impl is unsafe and unsound, but for Freeze we don't accept any user-defined impl, and it makes sense. Those traits are used for compiler-internal tracking; even if we decide to stabilize them, user code shouldn't be allowed to mess with them.
Note that on Freeze we also disallow negative impls (except inside std). This also makes sense to do here IMO, although here that justification is weaker.
Instead, this happened: the code compiles.
@rustbot label +F-unsafe_pinned +B-unstable +requires-nightly
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the provided nightly reproducer with the unsafe_unpin feature enabled, then trace how compiler-internal traits such as UnsafeUnpin and Freeze handle user-defined positive and negative impls. Done means the shown impl is rejected, with the corresponding negative-impl restriction addressed if applicable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100