-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-iteratorsArea: IteratorsArea: IteratorsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Location
HashMap
Summary
HashMap implements FromIterator and Extend, but does not document what happens if there are duplicate keys in the iterator. The documentation for Extend does say "When extending a collection with an already existing key, that entry is updated", but
- that isn't visible anywhere on the HashMap page,
- FromIterator doesn't have to be implemented using Extend (though HashMap's is), and
- that still doesn't specify behavior for duplicate keys in the iterator itself.
The current implementation silently takes the last value in the iterator, which is useful behavior and could easily be justified by saying "collection.extend(a).extend(b)
should always be equivalent to collection.extend(a.chain(b))
", but technically that isn't written down anywhere.
agausmann and wmmc88
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-iteratorsArea: IteratorsArea: IteratorsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.