Skip to content

Remove IndexMut impl from various collections to prepare for possible IndexSet in the future #23448

Closed
@nikomatsakis

Description

@nikomatsakis

I believe we intend to eventually extend the index traits with the ability to override the x[y] = z syntax specifically using a trait like IndexSet. This would allow hashmaps to be used like map[key] = value and have that insert the key, unlike today where map[key] = value will panic if key is not already present.

To pave the way, the simplest thing is to remove the IndexMut operator from those collections where we would anticipate growing on demand.

I believe that would be btree, hash_map, and possible vec_deque and vec_map.

Thoughts?

cc @aturon @alexcrichton @gankro

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions