Skip to content

Conversation

kpreid
Copy link
Contributor

@kpreid kpreid commented Dec 22, 2024

This behavior is worth documenting because there are other plausible alternatives, such as panicking when a duplicate is encountered, and it reminds the programmer to consider whether they should, for example, coalesce duplicate keys first.

Followup to #89869.

…te keys.

This behavior is worth documenting because there are other plausible
alternatives, such as panicking when a duplicate is encountered, and
it reminds the programmer to consider whether they should, for example,
coalesce duplicate keys first.
@rustbot
Copy link
Collaborator

rustbot commented Dec 22, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 22, 2024
Copy link
Member

@the8472 the8472 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're documenting the order here, this constrains future implementation changes.

And you're sometimes saying values and sometimes entries. That'd be even more constrianing because it means that either only values or keys and values must be replaced, depending on the method used, which can make a difference for keys that are equal but not identical.

@kpreid
Copy link
Contributor Author

kpreid commented Dec 22, 2024

Good point — I wasn't thinking of an appropriate middle ground between “no comment” and “document the precise behavior”. I have now updated the text so that in all cases it says

all but one (of the corresponding values)? will be dropped

which should be broad enough to permit all possible treatments of ordering.

@Mark-Simulacrum
Copy link
Member

@bors r+

I think this is OK, though the phrasing doesn't feel amazing to me (e.g., implication that duplicate keys are somehow not dropped - we do in fact drop(...) any secondary keys too).

@bors
Copy link
Collaborator

bors commented Dec 26, 2024

📌 Commit 6a43716 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 26, 2024
@bors bors merged commit 9551808 into rust-lang:master Dec 27, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 27, 2024
@kpreid kpreid deleted the duplicates branch December 27, 2024 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants