Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTreeMap: make Ord bound explicit, compile-test its absence #81610

Merged
merged 1 commit into from
Feb 6, 2021

Conversation

ssomers
Copy link
Contributor

@ssomers ssomers commented Jan 31, 2021

Most BTreeMap and BTreeSet members are subject to an Ord bound but a fair number of methods are not. To better convey and perhaps later tune the Ord bound, make it stand out in individual where clauses, instead of once far away at the beginning of an impl block. This PR does not introduce or remove any bounds.

Also adds compilation test cases checking that the bound doesn't creep in unintended on the historically unbounded methods.

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 31, 2021
@ssomers ssomers changed the title BTreeMap: make Ord bound explicit and double checked BTreeMap: make Ord bound explicit, double-check its absense Jan 31, 2021
@ssomers ssomers changed the title BTreeMap: make Ord bound explicit, double-check its absense BTreeMap: make Ord bound explicit, compile-test its absense Jan 31, 2021
@ssomers ssomers changed the title BTreeMap: make Ord bound explicit, compile-test its absense BTreeMap: make Ord bound explicit, compile-test its absence Feb 1, 2021
@ssomers
Copy link
Contributor Author

ssomers commented Feb 1, 2021

I realized there is no reason to touch entry.rs because all its members are equal (have the Ord bound).

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Feb 5, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 5, 2021

📌 Commit 1020784 has been approved by dtolnay

@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 Feb 5, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2021
Rollup of 7 pull requests

Successful merges:

 - rust-lang#80011 (Stabilize `peekable_next_if`)
 - rust-lang#81580 (Document how `MaybeUninit<Struct>` can be initialized.)
 - rust-lang#81610 (BTreeMap: make Ord bound explicit, compile-test its absence)
 - rust-lang#81664 (Avoid a hir access inside get_static)
 - rust-lang#81675 (Make rustdoc respect `--error-format short` in doctests)
 - rust-lang#81753 (Never MIR inline functions with a different instruction set)
 - rust-lang#81795 (Small refactor with Iterator::reduce)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 78be1aa into rust-lang:master Feb 6, 2021
@rustbot rustbot added this to the 1.51.0 milestone Feb 6, 2021
@ssomers ssomers deleted the btree_emphasize_ord_bound branch February 6, 2021 08:02
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants