Move logic for emitting UNSAFE_CODE for unsafe attributes to attr parsing#157201
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@rustbot label +I-lang-nominated Previously, the
This PR extends the lint to emit a lint for all unsafe attributes, which adds the following currently unsafe attributes:
|
This comment has been minimized.
This comment has been minimized.
810b455 to
bd1b6d1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bb9c4da to
b79a79e
Compare
|
Makes sense to me. Thanks @JonathanBrouwer for pushing this forward. I propose we do it: @rfcbot fcp merge lang One thing I'll mention is that we do use |
|
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. 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. |
b79a79e to
d7bad7f
Compare
This comment has been minimized.
This comment has been minimized.
|
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. |
d7bad7f to
5681079
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. |
|
@bors r=mati865 rollup |
|
📋 This PR cannot be approved because it currently has the following labels: |
|
@bors r=mati865 rollup |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
(spurious) |
Rollup merge of #157201 - JonathanBrouwer:unsafe-code-attribute, r=mati865 Move logic for emitting UNSAFE_CODE for unsafe attributes to attr parsing Fixes #131801 This moves the emitting of `UNSAFE_CODE` for unsafe attributes to attr parsing. Because it is now implemented generically for all unsafe attributes, we don't have to manually list all attributes anymore, and we can't miss adding support for new unsafe attributes in the future. This adds support for detecting `UNSAFE_CODE` for the following attributes: * `#[naked]` **(stable attribute!)** * `#[ffi_pure]` * `#[ffi_const]` * `#[force_target_feature]`
View all comments
Fixes #131801
This moves the emitting of
UNSAFE_CODEfor unsafe attributes to attr parsing.Because it is now implemented generically for all unsafe attributes, we don't have to manually list all attributes anymore, and we can't miss adding support for new unsafe attributes in the future.
This adds support for detecting
UNSAFE_CODEfor the following attributes:#[naked](stable attribute!)#[ffi_pure]#[ffi_const]#[force_target_feature]