rust-lang / rust-lang/rust

Tracking Issue for `PinCoerceUnsized`

Open
#150,112 1 comment 1 reaction 0 assignees View on GitHub

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
Unresolved Questions
Implementation history

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.