Tracking Issue for `PinCoerceUnsized`
Open
Nobody has claimed this yet.
A-coercions
A-DSTs
A-pin
C-tracking-issue
F-coerce_unsized
T-lang
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(pin_coerce_unsized_trait)]
This is a tracking issue for PinCoerceUnsized, which is an unsafe trait that determines whether unsizing coercions are possible when the given type is pinned.
Public API
/// # Safety
/// The impl of `Deref`/`DerefMut` for this type is not malicious.
pub unsafe trait PinCoerceUnsized: Deref {}
impl<Ptr, U> CoerceUnsized<Pin<U>> for Pin<Ptr>
where
Ptr: CoerceUnsized<U> + PinCoerceUnsized,
U: PinCoerceUnsized,
{}
impl<T: ?Sized> PinCoerceUnsized for &'_ T {}
impl<T: ?Sized> PinCoerceUnsized for &'_ mut T {}
impl<T: ?Sized> PinCoerceUnsized for Box<T> {}
impl<T: ?Sized> PinCoerceUnsized for Rc<T> {}
impl<T: ?Sized> PinCoerceUnsized for Arc<T> {}
// and so on for all smart pointers
Steps
- Implementation
- Stabilize
CoerceUnsizedfirst - Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
- Decide whether
PinCoerceUnsizedis the correct solution to https://github.com/rust-lang/rust/issues/68015 - Decide whether
Derefshould be a supertrait ofPinCoerceUnsized(it closes doors in terms of extendingPin<T>to non-DerefTs) or whether we should, e.g., use a sealed supertrait with a blanket impl or consider other options.
Implementation history
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 reviewing the PinCoerceUnsized feature gate, the linked implementation PRs, and the stabilization guide, with CoerceUnsized stabilization as a prerequisite. Done means resolving the listed design questions and completing a stabilization PR for the feature.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100