mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 12:36:35 +03:00
b2088a21df
Use a linting node closer the parsing of `#[cfg_attr]` The parsing of `#[cfg_attr]` unconditionally used the crate-root as a linting node to attach lints, but the `unexpected_cfgs` lint can fire when parsing the attribute and users expect to be able to allow it at places other than the crate-root. Let's instead use the linting node id, which is unfortunately always the parent but that's better than the crate-root when you are in a sub-module. The parsing of `#[cfg]` and other already use the expansion linting node id, so no change required there. Related to https://github.com/rust-lang/rust/issues/155118