Skip to content

std::rc::Rc should accept DST #18248

Closed
Closed
@little-arhat

Description

@little-arhat

It's currently impossible to store DST (Trait object, for example) inside RC:

let x:std::rc::Rc<Reader>;

gives you: the trait 'core::kinds::Sized' must be implemented because it is required by 'alloc::rc::Rc'. However, you can store trait object inside Box. Rc uses Box internally, so it seems inconsistent that one cannot use refcounted box as replacement for Box.

One could work around this issue by storing Box<Trait> inside Rc, but that would incur double indirection.

Moreover, one couldn't implement their own Rc because of related ICE: #17959 .

(Maybe related to: #16918 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions