Skip to content

Make HashSet::new a const fn #93140

Open
Open
@jyn514

Description

@jyn514

It shouldn't need to allocate, and it allows code like the following:

       const EMPTY_MAP: HashSet<u32> = HashSet::new();
        let x = match &set {
            Some(t) => t,
            None => &EMPTY_MAP,
        };

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API 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