Remove PartialOrd, Ord from DefId#90749
Conversation
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
r? @cjgillot |
This comment has been minimized.
This comment has been minimized.
a3fcf2c to
8ede793
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #89550) made this pull request unmergeable. Please resolve the merge conflicts. |
9328f94 to
84c3a03
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6024b94 to
200894f
Compare
This comment has been minimized.
This comment has been minimized.
PartialOrd, Ord from DefIdPartialOrd, Ord from DefId
|
☔ The latest upstream changes (presumably #90423) made this pull request unmergeable. Please resolve the merge conflicts. |
200894f to
8a04b94
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
|
☔ The latest upstream changes (presumably #91924) made this pull request unmergeable. Please resolve the merge conflicts. |
Remove `Ord` from `chalk_ir::interner::DefId` This change is required for rust-lang/rust#90749. For background on the initiative of removing ordering traits from items like `DefId` in `rustc`, see rust-lang/rust#90317.
|
@rustbot ready I suspect that many of the errors are from removing the various calls to In an earlier iteration of this PR, I tried just replacing everything in sight with Update: I tested each of the calls to |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Thanks for the PR @pierwill, I expected much less use of these ordering impls.
Could you please reorder/remix your commits into commits that pass x.py check? This makes it much easier to review and to better see the consequences of each modification.
The main concern is the iteration order in each place where we replace a BTree by a hash-map.
You can use the internal lint (lint has been removed)rustc::potential_query_instability to help finding such issues.
compiler/rustc_middle/src/ty/fold.rs
Outdated
There was a problem hiding this comment.
Is this FxHashMap used anyhere?
There was a problem hiding this comment.
Maybe not? 👀 🤔 I'm not entirely sure how to check. The lsp-find-references command in Emacs shows several places where the returned map is ignored:
compiler/rustc_borrowck/src/universal_regions.rs
736: let (value, _map) = self.tcx.replace_late_bound_regions(value, |br| {
compiler/rustc_middle/src/ty/fold.rs
821: self.replace_late_bound_regions(value, |br| {
911: self.replace_late_bound_regions(value, |_| self.lifetimes.re_erased).0
928: .replace_late_bound_regions(sig, |_| {
compiler/rustc_middle/src/ty/print/pretty.rs
2160: self.tcx.replace_late_bound_regions(value.clone(), |br| {
compiler/rustc_typeck/src/collect.rs
457: .replace_late_bound_regions(poly_trait_ref, |_| {
compiler/rustc_middle/src/ty/fold.rs
Outdated
There was a problem hiding this comment.
Does any use site rely on the iteration order?
There was a problem hiding this comment.
Maybe here?
There was a problem hiding this comment.
Where is this FxHashMap used? Does any code depend on the iteration order?
There was a problem hiding this comment.
This map is used in two places:
rust/compiler/rustc_middle/src/ty/print/pretty.rs
Lines 806 to 807 in 181e915
There was a problem hiding this comment.
Used in the same calls as above #90749 (comment).
There was a problem hiding this comment.
Does any code depend on the iteration order?
There was a problem hiding this comment.
Yes:
There was a problem hiding this comment.
Does any code depend on the iteration order?
There was a problem hiding this comment.
Possibly here?
rust/compiler/rustc_trait_selection/src/traits/project.rs
Lines 464 to 484 in f1ce0e6
There was a problem hiding this comment.
This impl is wrong and will probably produce surprising results.
We implement Eq, so we expect a real equality, not just CrateNum.
Is the PartialOrd/Ord bound used? Where? Can we live without?
There was a problem hiding this comment.
The ordering is used here https://github.com/rust-lang/rust/blob/088dd7cb54f57bd1c870a343cb5dc3d3d2703761/compiler/rustc_typeck/src/check/method/suggest.rs#L1651 and in the PartialEq implementation: https://github.com/rust-lang/rust/blob/088dd7cb54f57bd1c870a343cb5dc3d3d2703761/compiler/rustc_typeck/src/check/method/suggest.rs#L1906
There was a problem hiding this comment.
And the Eq,PartialEq are currently used for deduplication: https://github.com/rust-lang/rust/blob/088dd7cb54f57bd1c870a343cb5dc3d3d2703761/compiler/rustc_typeck/src/check/method/suggest.rs#L1652
There was a problem hiding this comment.
Would it work or defeat our purpose to sort the TraitInfos by DefIndex?
There was a problem hiding this comment.
Do we still rely on the iteration order?
There was a problem hiding this comment.
Yes:
rust/compiler/rustc_typeck/src/astconv/mod.rs
Line 1403 in 181e915
There was a problem hiding this comment.
Do we rely somewhere on the iteration order?
There was a problem hiding this comment.
Yes:
a3758d2 to
ef06eda
Compare
This comment has been minimized.
This comment has been minimized.
a415d8e to
088dd7c
Compare
This comment has been minimized.
This comment has been minimized.
088dd7c to
a75ba63
Compare
This comment has been minimized.
This comment has been minimized.
a75ba63 to
c600b95
Compare
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #92844) made this pull request unmergeable. Please resolve the merge conflicts. |
c600b95 to
2b0b438
Compare
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #92805) made this pull request unmergeable. Please resolve the merge conflicts. |
2b0b438 to
9f0d58f
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Remove some unused `Ord` derives based on `Span` Remove some `Ord`, `PartialOrd` derivations that rely on underlying ordering of `Span`. These ordering traits appear to be unused right now. If we're going to attempt to remove ordering traits from `Span` as suggested in rust-lang#90317 (comment), we might want to slowly remove code that depends on this ordering (as opposed to the all-at-once approach in rust-lang#90749 and rust-lang#90408). cc `@tmiasko` `@cjgillot`
|
Closing this (for now), as I'm looking at making this change in a series of smaller PRs. |
…gillot Remove some unused ordering derivations based on `DefId` Like rust-lang#93018, this removes some unused/unneeded ordering derivations as part of ongoing work on rust-lang#90317. Here, these changes are aimed at making rust-lang#90749 easier to review, test, and merge. r? `@cjgillot`
Part of work on #90317.