Report the unsafe_attr_outside_unsafe lint at the closest node#140617
Report the unsafe_attr_outside_unsafe lint at the closest node#140617bors merged 2 commits intorust-lang:masterfrom
unsafe_attr_outside_unsafe lint at the closest node#140617Conversation
jieyouxu
left a comment
There was a problem hiding this comment.
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 was discussed in today's compiler triage meeting. We considered the beta backport nomination but decided to decline this beta backport. The beta backport was considered but rejected because:
@rustbot label: -beta-nominated |
This PR have
AstValidationtrack a linting node id and then uses it when reporting theunsafe_attr_outside_unsafelint, so that instead of being bound at the crate-root,#[allow]of the lint works at any node.Fixes #140602
r? @jieyouxu