-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Stop sorting Span
s' SyntaxContext
, as that is incompatible with incremental
#123165
Conversation
compiler/rustc_span/src/lib.rs
Outdated
@@ -460,21 +460,21 @@ impl Ord for SpanData { | |||
let SpanData { | |||
lo: s_lo, | |||
hi: s_hi, | |||
ctxt: s_ctxt, | |||
ctxt: _, |
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.
This needs a comment for macro expansions.
Side note: this Ord
impl is not consistent with the derived impl for PartialEq
. Should we fix the latter?
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.
What do you think about ensuring that for equal (including the sort-ignored fields) SpanData
s we just return Ordering::Equal
, and only sort the others?
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.
That's not consistent either.
The a == b
implies partial_cmp(a, b) == Some(Equal)
direction is easy. We have it without adding a special case.
The converse is harder: if s_lo == o_lo && s_hi == o_hi
we get Some(Equal)
, but s_ctxt
may not be o_ctxt
.
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.
Maybe Span
s should just be PartialOrd
, but not Ord
. I'll try if we can get away with just removing Ord
Edit: ah no, we need Ord
for sort
and friends.
Yea, idk how to solve this in a way that makes everything work out, except go full in with https://github.com/rust-lang/rust/compare/master...oli-obk:rust:no_ord_span?expand=1, no matter how annoying it is
Is it hard to remove |
@rustbot author I'll explore that, but I think at least borrowck uses it to sort its diagnostics |
I tried it, but sorting spans is used all over the compiler, even if we added convenience helpers for it, the right way would be to replace most of these spans with a |
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@bors r+ rollup=never |
☀️ Test successful - checks-actions |
Finished benchmarking commit (25c9f2c): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (secondary -2.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 694.36s -> 694.089s (-0.04%) |
work towards #90317
Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered.
r? @cjgillot