Skip to content

Consider replacing RawVec<T> with Box<[MaybeUninit<T>]>. #54470

Open
@eddyb

Description

@eddyb

After #53508 lands, we could look into this. It might provide a bit more type-safety, although it could be worse to not have the capacity as a separate field.

One thing to note is that setting the "length" component of a reference/pointer to [MaybeUninit<T>] is "less unsafe" than doing so for for [T], but it's unclear to me whether having a &[MaybeUninit<T>] that's larger than the object it points to, is UB or not. (please ignore, I managed to confuse myself)

cc @RalfJung @gankro @rust-lang/libs

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsArea: `std::collections`T-libsRelevant to the library 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