-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Remove attributes from generics in built-in derive macros #132651
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
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.
Could you add regression tests for #132561?
Note to others: This is consistent with the current behavior for type parameters. I've thought about the change proposed here and while technically technically speaking it's a breaking change, I don't think it's observable by the user -- apart from affecting the emission of lints
|
@fmease, I'll pass the review to you. |
@fmease Is there a problem? I don't want to be annoying or rush things, just wondering. My project is partially blocked by this bug, so I'm just not sure if I am to expect a fix (whether this PR, or something else) to be merged in a relatively short time frame, or should I just use a workaround in my project for now? Again, I don't want to rush anything, just want to know what is the situation 😅 |
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.
Sorry for the delay, one suggestion
.map(|mut param| { | ||
// Remove all attributes, because there might be helper attributes | ||
// from other macros that will not be valid in the expanded implementation. | ||
param.attrs = ThinVec::new(); |
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.
Right now, we clear the attrs of the param after having cloned the entire param. As a result we clone the attrs only to throw them away. However, avoiding this makes the code more awkward. I've just noticed that we also needlessly clone const parameter defaults. Er, this could be addressed in a separate PR, if need be.
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.
I think the compiler would optimize it away, and writing it like this is easier to read?
Either way, if this whole thing might be significantly changed in the near future by addressing the real bug here (#61552), I don't think it's necessary to do anything about it in this PR
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.
Ah, I forgot to say, could you squash into one commit? Then I'll place it into merge queue.
add a test add github issue link to description of the test replace new ThinVec with clear() Co-authored-by: León Orell Valerian Liehr <[email protected]>
@fmease Done |
This is clearly a bug fix and doesn't need T-lang involvement (cc rust-lang/lang-team#290). @bors r+ |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#132651 (Remove attributes from generics in built-in derive macros) - rust-lang#132668 (Feature gate yield expressions not in 2024) - rust-lang#132771 (test(configure): cover `parse_args` in `src/bootstrap/configure.py`) - rust-lang#132895 (Generalize `NonNull::from_raw_parts` per ACP362) - rust-lang#132914 (Update grammar in std::cell docs.) - rust-lang#132927 (Consolidate type system const evaluation under `traits::evaluate_const`) - rust-lang#132935 (Make sure to ignore elided lifetimes when pointing at args for fulfillment errors) - rust-lang#132941 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132651 - PonasKovas:master, r=fmease Remove attributes from generics in built-in derive macros Related issue rust-lang#132561 Removes all attributes from generics in the expanded implementations of built-in derive macros.
Related issue #132561
Removes all attributes from generics in the expanded implementations of built-in derive macros.