Rollup merge of #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/rust#140602 r? `@jieyouxu`
This commit is contained in:
commit
54821b9ed0
5 changed files with 46 additions and 8 deletions
|
|
@ -0,0 +1,16 @@
|
|||
//@ check-pass
|
||||
//@ edition: 2021
|
||||
//
|
||||
// Anti-regression test for https://github.com/rust-lang/rust/issues/140602
|
||||
// where the generated warning couldn't be allowed due too being attached to
|
||||
// the wrong AST node.
|
||||
|
||||
#![deny(unsafe_attr_outside_unsafe)]
|
||||
|
||||
#[allow(unsafe_attr_outside_unsafe)]
|
||||
mod generated {
|
||||
#[no_mangle]
|
||||
fn _generated_foo() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue