Skip to content

Branch on needs_drop in Vec::drop? #24280

Closed
@SimonSapin

Description

@SimonSapin

When a arena::TypedArena is dropped, it uses std::intrinsics::needs_drop to skip entirely the loop that reads items and runs their destructors.

Vec however does no such thing, and runs a similar loop unconditionally. Should it check needs_drop as well, or can we rely on the loop being optimized away entirely when it does nothing?

cc @pnkfelix, @gankro

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions