Skip to content

needs_drop intrinsic #2055

Closed
Closed
@nikomatsakis

Description

@nikomatsakis

We should add a needs_drop<T> intrinsic that is true if the type requires drop glue. We could then implement a vec::clear() method that clears out the contents of a vector efficiently, avoiding the execution of drop glue if the vector has a type like [int]. vec::slice() is another example of where this might be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions