- Notifications
You must be signed in to change notification settings - Fork 14.1k
Emit an error if #[optimize] is applied to an incompatible item #128458
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Collaborator
| r? @fee1-dead rustbot has assigned @fee1-dead. Use |
compiler-errors requested changes Jul 31, 2024
Member
compiler-errors left a comment
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.
Needs a test
9fb7690 to 10cc993 Compare This comment has been minimized.
This comment has been minimized.
10cc993 to 79a15fa Compare 79a15fa to 6d7bb12 Compare compiler-errors approved these changes Aug 1, 2024
Member
| @bors r+ rollup |
Collaborator
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 1, 2024
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#128416 (android: Remove libstd hacks for unsupported Android APIs) - rust-lang#128437 (improve bootstrap to allow selecting llvm tools individually) - rust-lang#128450 (Create COFF archives for non-LLVM backends) - rust-lang#128458 (Emit an error if `#[optimize]` is applied to an incompatible item) - rust-lang#128477 (Finish blessing `coverage/mcdc` tests after LLVM 19 upgrade) - rust-lang#128478 (Ignore `use` declaration reformatting in `.git-blame-ignore-revs`.) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 1, 2024
Rollup merge of rust-lang#128458 - clubby789:optimize-unused-attr, r=compiler-errors Emit an error if `#[optimize]` is applied to an incompatible item rust-lang#54882 The RFC specifies that this should emit a lint. I used the same allow logic as the `coverage` attribute (also allowing modules and impl blocks) - this should possibly be changed depending on if it's decided to allow 'propogation' of the attribute.
tgross35 added a commit to tgross35/rust that referenced this pull request Aug 8, 2024
…pos, r=BoxyUwU Emit an error for invalid use of the `#[no_sanitize]` attribute fixes rust-lang#128487. Currently, the use of the `#[no_sanitize]` attribute for Mod, Impl,... is incorrectly permitted. This PR will correct this issue by generating errors, and I've also added some UI test cases for it. Referenced rust-lang#128458. As far as I know, the `#[no_sanitize]` attribute can only be used with functions, so I changed that part to `Fn` and `Method` using `check_applied_to_fn_or_method`. However, I couldn't find explicit documentation on this, so I could be mistaken...
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 8, 2024
Rollup merge of rust-lang#128552 - s7tya:check-no-sanitize-attribute-pos, r=BoxyUwU Emit an error for invalid use of the `#[no_sanitize]` attribute fixes rust-lang#128487. Currently, the use of the `#[no_sanitize]` attribute for Mod, Impl,... is incorrectly permitted. This PR will correct this issue by generating errors, and I've also added some UI test cases for it. Referenced rust-lang#128458. As far as I know, the `#[no_sanitize]` attribute can only be used with functions, so I changed that part to `Fn` and `Method` using `check_applied_to_fn_or_method`. However, I couldn't find explicit documentation on this, so I could be mistaken...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
#54882
The RFC specifies that this should emit a lint. I used the same allow logic as the
coverageattribute (also allowing modules and impl blocks) - this should possibly be changed depending on if it's decided to allow 'propogation' of the attribute.