-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Report the unsafe_attr_outside_unsafe
lint at the closest node
#140617
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
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.
Thanks! One nit, but r=me otherwise
tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-allow.rs
Outdated
Show resolved
Hide resolved
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
Don't know if we want to backport this to beta, it's in stable ever since this lint was implemented I think |
c230ca1
to
f4e1ec1
Compare
I'll nominate this for beta-backport discussion at least. This PR fixes a bug reported in #140602, where it wasn't possible to #![deny(unsafe_attr_outside_unsafe)]
#[allow(unsafe_attr_outside_unsafe)]
mod generated {
#[no_mangle]
fn _generated_foo() {}
} This was broken since the @rustbot label: +beta-nominated |
Rollup of 7 pull requests Successful merges: - rust-lang#139675 (Add the AVX10 target features) - rust-lang#140286 (Check if format argument is identifier to avoid error err-emit) - rust-lang#140456 (Fix test simd/extract-insert-dyn on s390x) - rust-lang#140551 (Move some tests out of tests/ui) - rust-lang#140588 (Adjust some ui tests re. target-dependent errors) - rust-lang#140617 (Report the `unsafe_attr_outside_unsafe` lint at the closest node) - rust-lang#140626 (allow `#[rustfmt::skip]` in combination with `#[naked]`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#140617 - Urgau:unsafe_attr-lint-allow, r=jieyouxu Report the `unsafe_attr_outside_unsafe` lint at the closest node This PR have `AstValidation` track a linting node id and then uses it when reporting the `unsafe_attr_outside_unsafe` lint, so that instead of being bound at the crate-root, `#[allow]` of the lint works at any node. Fixes rust-lang#140602 r? `@jieyouxu`
…=Urgau Small adjustments to `check_attribute_safety` to make the logic more obvious Follow-up to rust-lang#140617.
Rollup merge of rust-lang#140619 - jieyouxu:validate_attr_cleanups, r=Urgau Small adjustments to `check_attribute_safety` to make the logic more obvious Follow-up to rust-lang#140617.
This PR have
AstValidation
track a linting node id and then uses it when reporting theunsafe_attr_outside_unsafe
lint, so that instead of being bound at the crate-root,#[allow]
of the lint works at any node.Fixes #140602
r? @jieyouxu