Implement fast path for derive(PartialOrd) when deriving Ord#155598
Conversation
|
Changes to the code generated for builtin derived traits. cc @nnethercote |
|
rustbot has assigned @ShoyuVanilla. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| cx.dcx().span_bug(field.span, "not exactly 2 arguments in `derive(Ord)`"); | ||
| cx.dcx() | ||
| .span_bug(field.span, "not exactly 2 arguments in `derive(PartialOrd)`"); | ||
| }; |
There was a problem hiding this comment.
I think this is probably a copy-paste curse, so I changed that, not 100% sure though.
This comment has been minimized.
This comment has been minimized.
|
I can review this: r? @nnethercote cc @theemathas, who has made good comments on similar PRs in the past. |
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Implement fast path for `derive(PartialOrd)` when deriving `Ord`
| resolutions: Vec<DeriveResolution>, | ||
| helper_attrs: Vec<(usize, IdentKey, Span)>, | ||
| // if this list keeps getting extended, we could use `bitflags`, | ||
| // something like what [`rustc_type_ir::flags::TypeFlags`] is doing. |
There was a problem hiding this comment.
We had multiple flags here in the past, and they indeed used flags, and one map in the resolver instead of two containers_deriving_(copy,ord) maps.
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks for providing the context. I was thinking about doing one more round of scanning derives to collect all flags such that it might solve #124794. I don't know if that had been discussed before, and if it did I'd really want to know the reason of why not doing that.
There was a problem hiding this comment.
one more round of scanning derives to collect all flags
If I correctly understand what you are talking about, it's a much worse hack and it cannot work correctly.
We already doing something like that to support deprecation lint legacy_derive_helpers, and that logic is going to be removed soon.
|
Similarly to the existing Moreover, the |
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Implement fast path for `derive(PartialOrd)` when deriving `Ord`
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 3f43613 failed: CI. Failed job:
|
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 23a3312 (parent) -> dd8b2d6 (this PR) Test differencesShow 2 test diffs2 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard dd8b2d6162c5616d7030238c29f892a431093cdd --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (dd8b2d6): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Our benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -2.3%, secondary 7.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.2%, secondary 3.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.2%, secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 511.109s -> 511.311s (0.04%) |
View all comments
Closes: #155537
Unfortunately, this PR shares the same issue with #124794, which doesn't work when
derive(PartialOrd)is beforederive(Ord).