Skip to content

Add T: ?Sized to the From<Box<T>> impl for Pin<Box<T>> #56256

Closed
@DutchGhost

Description

@DutchGhost

Currently, the implementation for From<Box<T>> for Pin<Box<T>> is defined as:

impl<T> From<Box<T>> for Pin<Box<T>>

https://doc.rust-lang.org/nightly/std/pin/struct.Pin.html#impl-From%3CBox%3CT%3E%3E

This does not allow trait objects to be pinned. It is however possible to call Box::pinned, and convert that into a trait object.

Is it intentional that T is required to be Sized on the From implementation?

Defining it as this:

impl<T: ?Sized> From<Box<T>> for Pin<Box<T>>

allows to call Pin::from(trait_object)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions