Skip to content

Tracking Issue for PinCoerceUnsized #150112

Description

@Darksonn

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)A-coercionsArea: implicit and explicit `expr as Type` coercionsA-pinArea: PinC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-coerce_unsizedThe `CoerceUnsized` traitT-langRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions