-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Warn on codegen attributes on required trait methods #148756
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
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
r? jdonszelmann |
|
@rfcbot fcp merge lang |
|
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
@rfcbot reviewed |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
So, I'd like to file a concern here that we should do a crater run on this before landing. Here's my reasoning: This is landing as a FCW, which means that the team wants to remove this behavior, In my mind, this means that the team should know what the barriers are for that. If, for example, crater says that nobody is relying on it, it may mean that we want to move rather fast on that. If crater shows that a bunch of crates are relying on this, we should know that to be able to plan (I think Niko mentioned e.g. making the change over an edition in that case would be a possibility). Essentially, the concern from me is that a FCW here indicates it's important enough for people to think about, and I think that the lang team should have the data about who it effects. And, not blocking landing this on that data runs the (high) risk of it falling through the cracks. |
|
@rfcbot concern jackh726-concern |
|
@JonathanBrouwer could you make a parallel PR that makes this a full error, then we crater that. Or at least I believe we wouldn't see this warning in a crate run right? |
… r=<try> Crater for #148756
|
Crater run will happen here: #149137 |
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
Signed-off-by: Jonathan Brouwer <[email protected]>
Signed-off-by: Jonathan Brouwer <[email protected]>
c49ff7a to
8fa10c0
Compare
|
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. |
|
@rustbot ready |
|
@bors r+ rollup |
…ts2, r=jdonszelmann Warn on codegen attributes on required trait methods This PR turns applying the following attributes on required trait methods (that is, trait methods **without** a default implementation) into a FCW: - `#[cold]` - `#[link_section]` - `#[linkage]` (unstable) - `#[rustc_allow_const_fn_unstable]` (internal attribute) These attributes already had no effect when applied to a required trait method, this PR only adds a warning. Furthermore, it adds a comment in the code that the following codegen attributes are *inherited* when applied to a required trait method: - `#[track_caller]` - `#[align]` (unstable) `@rustbot` labels +I-lang-nominated `@rust-lang/lang` Two questions for the lang team: - Is adding this warning ok? - Does the current behaviour of these attributes align with that you would expect them to be? Fixes rust-lang#147432
Rollup of 9 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149354 (Bootstrap config: libgccjit libs dir) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150000 (Port `#[rustc_legacy_const_generics]` to use attribute parser ) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) r? `@ghost` `@rustbot` modify labels: rollup
…ts2, r=jdonszelmann Warn on codegen attributes on required trait methods This PR turns applying the following attributes on required trait methods (that is, trait methods **without** a default implementation) into a FCW: - `#[cold]` - `#[link_section]` - `#[linkage]` (unstable) - `#[rustc_allow_const_fn_unstable]` (internal attribute) These attributes already had no effect when applied to a required trait method, this PR only adds a warning. Furthermore, it adds a comment in the code that the following codegen attributes are *inherited* when applied to a required trait method: - `#[track_caller]` - `#[align]` (unstable) ``@rustbot`` labels +I-lang-nominated ``@rust-lang/lang`` Two questions for the lang team: - Is adding this warning ok? - Does the current behaviour of these attributes align with that you would expect them to be? Fixes rust-lang#147432
Rollup of 8 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150000 (Port `#[rustc_legacy_const_generics]` to use attribute parser ) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) r? `@ghost` `@rustbot` modify labels: rollup
…ts2, r=jdonszelmann Warn on codegen attributes on required trait methods This PR turns applying the following attributes on required trait methods (that is, trait methods **without** a default implementation) into a FCW: - `#[cold]` - `#[link_section]` - `#[linkage]` (unstable) - `#[rustc_allow_const_fn_unstable]` (internal attribute) These attributes already had no effect when applied to a required trait method, this PR only adds a warning. Furthermore, it adds a comment in the code that the following codegen attributes are *inherited* when applied to a required trait method: - `#[track_caller]` - `#[align]` (unstable) ```@rustbot``` labels +I-lang-nominated ```@rust-lang/lang``` Two questions for the lang team: - Is adding this warning ok? - Does the current behaviour of these attributes align with that you would expect them to be? Fixes rust-lang#147432
Rollup of 14 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149771 (bootstrap readme: make easy to read when editor wrapping is not enabled) - #149856 (Provide an extended framework for type visit, for use in rust-analyzer) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) - #150022 (Generate macro expansion for rust compiler crates docs) - #150029 (Update books) - #150031 (assert impossible branch is impossible) - #150034 (do not add `I-prioritize` when `F-*` labels are present) - #150036 (Use the embeddable filename for coverage artifacts) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 13 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149771 (bootstrap readme: make easy to read when editor wrapping is not enabled) - #149856 (Provide an extended framework for type visit, for use in rust-analyzer) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) - #150029 (Update books) - #150031 (assert impossible branch is impossible) - #150034 (do not add `I-prioritize` when `F-*` labels are present) - #150036 (Use the embeddable filename for coverage artifacts) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #148756 - JonathanBrouwer:link_section_targets2, r=jdonszelmann Warn on codegen attributes on required trait methods This PR turns applying the following attributes on required trait methods (that is, trait methods **without** a default implementation) into a FCW: - `#[cold]` - `#[link_section]` - `#[linkage]` (unstable) - `#[rustc_allow_const_fn_unstable]` (internal attribute) These attributes already had no effect when applied to a required trait method, this PR only adds a warning. Furthermore, it adds a comment in the code that the following codegen attributes are *inherited* when applied to a required trait method: - `#[track_caller]` - `#[align]` (unstable) ````@rustbot```` labels +I-lang-nominated ````@rust-lang/lang```` Two questions for the lang team: - Is adding this warning ok? - Does the current behaviour of these attributes align with that you would expect them to be? Fixes #147432
This PR turns applying the following attributes on required trait methods (that is, trait methods without a default implementation) into a FCW:
#[cold]#[link_section]#[linkage](unstable)#[rustc_allow_const_fn_unstable](internal attribute)These attributes already had no effect when applied to a required trait method, this PR only adds a warning.
Furthermore, it adds a comment in the code that the following codegen attributes are inherited when applied to a required trait method:
#[track_caller]#[align](unstable)@rustbot labels +I-lang-nominated
@rust-lang/lang
Two questions for the lang team:
Fixes #147432