Rollup merge of #94433 - Urgau:check-cfg-allowness, r=petrochenkov
Improve allowness of the unexpected_cfgs lint This pull-request improve the allowness (`#[allow(...)]`) of the `unexpected_cfgs` lint. Before this PR only crate level `#![allow(unexpected_cfgs)]` worked, now with this PR it also work when put around `cfg!` or if it is in a upper level. Making it work ~for the attributes `cfg`, `cfg_attr`, ...~ for the same level is awkward as the current code is design to give "Some parent node that is close to this macro call" (cf. https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/struct.ExpansionData.html) meaning that allow on the same line as an attribute won't work. I'm note even sure if this would be possible. Found while working on https://github.com/rust-lang/rust/pull/94298. r? ````````@petrochenkov````````
This commit is contained in:
commit
493ed7a6af
14 changed files with 122 additions and 26 deletions
|
@ -2,6 +2,7 @@ use crate::interface::{Compiler, Result};
|
|||
use crate::proc_macro_decls;
|
||||
use crate::util;
|
||||
|
||||
use ast::CRATE_NODE_ID;
|
||||
use rustc_ast::mut_visit::MutVisitor;
|
||||
use rustc_ast::{self as ast, visit};
|
||||
use rustc_borrowck as mir_borrowck;
|
||||
|
@ -188,7 +189,7 @@ pub fn register_plugins<'a>(
|
|||
)
|
||||
});
|
||||
|
||||
let (krate, features) = rustc_expand::config::features(sess, krate);
|
||||
let (krate, features) = rustc_expand::config::features(sess, krate, CRATE_NODE_ID);
|
||||
// these need to be set "early" so that expansion sees `quote` if enabled.
|
||||
sess.init_features(features);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue