Implement fast path for derive(PartialOrd) when deriving Ord#155598
Implement fast path for derive(PartialOrd) when deriving Ord#155598makai410 wants to merge 5 commits into
derive(PartialOrd) when deriving Ord#155598Conversation
|
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.
|
But anyway, I don't think the current way is that bad, we just want to know if there is any other |
|
Changes to the code generated for builtin derived traits. cc @nnethercote |
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+ |
View all comments
Closes: #155537
Unfortunately, this PR shares the same issue with #124794, which doesn't work when
derive(PartialOrd)is beforederive(Ord).