-
Notifications
You must be signed in to change notification settings - Fork 14k
impl !PartialOrd for HirId #138610
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
impl !PartialOrd for HirId #138610
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
compiler-errors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just nits, maybe i'm missing something about the things i asked
| fn sort_lints(sess: &Session, mut lints: Vec<&'static Lint>) -> Vec<&'static Lint> { | ||
| // The sort doesn't case-fold but it's doubtful we care. | ||
| lints.sort_by_cached_key(|x: &&Lint| (x.default_level(sess.edition()), x.name)); | ||
| lints.sort_by(|a, b| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this change? Isn't this doing the same exact thing as previosuly? (Sorting by a key of default_level + name?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lack of Ord impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why does it only have a partial ordering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like, if the reason is because of those skip'd arguments in the derive, then if I'm not mistaken then even the PartialOrd impl violates the guarantee that
a == b if and only if partial_cmp(a, b) == Some(Equal)
i.e. it is inconsistent w/ PartialEq.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, actually the more I think about this, it seems to me to that LintLevel now has and invalid impl of partialord 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a manual impl before that first did an equality check. But I have been considering instead to remove the LintExpectationId fields and store them elsewhere. It's a bit involved, so I'm gonna try landing that on its own on master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that worked out nicely, just tripled the size of the PR ^^
compiler/rustc_passes/src/dead.rs
Outdated
| return; | ||
| } | ||
| dead_codes.sort_by_key(|v| v.level); | ||
| dead_codes.sort_by(|a, b| a.level.partial_cmp(&b.level).unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort_by_key(|a| a.level)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Level isn't Ord anymore
| }; | ||
| let upvar_base = upvar_owner.get_or_insert(var_id.owner); | ||
| assert_eq!(*upvar_base, var_id.owner); | ||
| let var_id = var_id.local_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you inline this into its usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are no early returns, so I thought it good to do the check and the conversion as early as possible
This comment has been minimized.
This comment has been minimized.
3da287a to
84d7916
Compare
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
84d7916 to
0dde879
Compare
|
Some changes occurred to the CTFE machinery Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in exhaustiveness checking cc @Nadrieril Some changes occurred in match checking cc @Nadrieril |
compiler-errors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after question, since I think my previous concern still applies here w/ this sort_by_key -> sort_by change.
|
@bors r=compiler-errors rollup |
…r-errors impl !PartialOrd for HirId revive of rust-lang#92233 Another checkbox of rust-lang#90317, another small step in making incremental less likely to die in horrible ways
|
may need rebase after #139269 lands |
…r-errors impl !PartialOrd for HirId revive of rust-lang#92233 Another checkbox of rust-lang#90317, another small step in making incremental less likely to die in horrible ways
|
@bors r- |
|
Looks like this PR was the cause of a failure in this rollup: #139300 (comment) |
|
@bors r=compiler-errors rollup |
|
The impl changes don't look trivial, maybe this could use a perf. run or at least be marked as iffy/maybe? 🤔 Edit: nevermind, the rollup this was in was a perf. win. |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#138017 (Tighten up assignment operator representations.) - rust-lang#138462 (Dedup `&mut *` reborrow suggestion in loops) - rust-lang#138610 (impl !PartialOrd for HirId) - rust-lang#138767 (Allow boolean literals in `check-cfg`) - rust-lang#139068 (io: Avoid marking some bytes as uninit) - rust-lang#139255 (Remove unused variables generated in merged doctests) - rust-lang#139270 (Add a mailmap entry for myself) - rust-lang#139303 (Put Noratrieb on vacation) - rust-lang#139312 (add Marco Ieni to mailmap) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#138610 - oli-obk:no-sort-hir-ids, r=compiler-errors impl !PartialOrd for HirId revive of rust-lang#92233 Another checkbox of rust-lang#90317, another small step in making incremental less likely to die in horrible ways
…r-errors impl !PartialOrd for HirId revive of rust-lang#92233 Another checkbox of rust-lang#90317, another small step in making incremental less likely to die in horrible ways
revive of #92233
Another checkbox of #90317, another small step in making incremental less likely to die in horrible ways