-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Manually order DefId
on 64-bit big-endian
#102382
Conversation
`DefId` uses different field orders on 64-bit big-endian vs. others, in order to optimize its `Hash` implementation. However, that also made it derive different lexical ordering for `PartialOrd` and `Ord`. That caused spurious differences wherever `DefId`s are sorted, like the candidate sources list in `report_method_error`. Now we manually implement `PartialOrd` and `Ord` on 64-bit big-endian to match the same lexical ordering as other targets, fixing at least one test, `src/test/ui/methods/method-ambig-two-traits-cross-crate.rs`.
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
Relying on the |
Are there any plans to remove |
OK, well that looks like a huge effort, but it can easily drop the changes I'm making here when that goes through.
As for this, I think the test doesn't really care about order at all, just that it needs to be reproducible enough for UI to match. I can look at other more-stable options. |
@bors r+ |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#102276 (Added more const_closure functionality) - rust-lang#102382 (Manually order `DefId` on 64-bit big-endian) - rust-lang#102421 (remove the unused :: between trait and type to give user correct diag…) - rust-lang#102495 (Reinstate `hir-stats.rs` test for stage 1.) - rust-lang#102505 (rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`) - rust-lang#102506 (Specify `DynKind::Dyn`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
DefId
uses different field orders on 64-bit big-endian vs. others, inorder to optimize its
Hash
implementation. However, that also made itderive different lexical ordering for
PartialOrd
andOrd
. Thatcaused spurious differences wherever
DefId
s are sorted, like thecandidate sources list in
report_method_error
.Now we manually implement
PartialOrd
andOrd
on 64-bit big-endian tomatch the same lexical ordering as other targets, fixing at least one
test,
src/test/ui/methods/method-ambig-two-traits-cross-crate.rs
.