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

impl !PartialOrd for HirId #138610

Merged
merged 6 commits into from
Apr 4, 2025
Merged

impl !PartialOrd for HirId #138610

merged 6 commits into from
Apr 4, 2025

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Mar 17, 2025

revive of #92233

Another checkbox of #90317, another small step in making incremental less likely to die in horrible ways

@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2025

r? @fmease

rustbot has assigned @fmease.
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Copy link
Member

@compiler-errors compiler-errors left a 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

@@ -903,7 +903,11 @@ Available lint options:

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| {
Copy link
Member

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?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lack of Ord impl

Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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 🤔

Copy link
Contributor Author

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

Copy link
Contributor Author

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 ^^

@@ -1131,7 +1131,7 @@ impl<'tcx> DeadVisitor<'tcx> {
if dead_codes.is_empty() {
return;
}
dead_codes.sort_by_key(|v| v.level);
dead_codes.sort_by(|a, b| a.level.partial_cmp(&b.level).unwrap());
Copy link
Member

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)?

Copy link
Contributor Author

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

@@ -866,6 +867,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
HirPlaceBase::Upvar(upvar_id) => upvar_id.var_path.hir_id,
_ => bug!("Expected an upvar"),
};
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;
Copy link
Member

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?

Copy link
Contributor Author

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

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

Some changes occurred in exhaustiveness checking

cc @Nadrieril

Some changes occurred in match checking

cc @Nadrieril

Copy link
Member

@compiler-errors compiler-errors left a 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.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 1, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 2, 2025

@bors r=compiler-errors rollup

@bors
Copy link
Collaborator

bors commented Apr 2, 2025

📌 Commit 7103ce7 has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 2, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 2, 2025
…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
@matthiaskrgr
Copy link
Member

may need rebase after #139269 lands

m-ou-se added a commit to m-ou-se/rust that referenced this pull request Apr 3, 2025
…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
@matthiaskrgr
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 3, 2025
@m-ou-se
Copy link
Member

m-ou-se commented Apr 3, 2025

Looks like this PR was the cause of a failure in this rollup: #139300 (comment)

@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 3, 2025

@bors r=compiler-errors rollup

@bors
Copy link
Collaborator

bors commented Apr 3, 2025

📌 Commit 57c4ab7 has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 3, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Apr 3, 2025

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.

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2025
…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
@bors bors merged commit 48a3919 into rust-lang:master Apr 4, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 4, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 4, 2025
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
@oli-obk oli-obk deleted the no-sort-hir-ids branch April 4, 2025 05:06
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants