Skip to content

unknown_lints doesn't trigger in all cfg_attr #97094

Closed
@Xiphoseer

Description

@Xiphoseer

I tried this code:

#![deny(warnings)]
#![cfg_attr(all(), allow(lint1))]

#[cfg_attr(all(), allow(lint2))]
mod baz {
    #![cfg_attr(all(), allow(lint3))]
}

#[cfg_attr(all(), allow(lint4))]
pub fn test() {}

Playground Link

I expected attributs in all 4 positions to cause compiler errors, but just the first one (inner attribute on the root module) does. When using allow without cfg_attr I get all 4 errors. Came across this while debugging why adding #![cfg_attr(feature = "name", allow(unused_macro_rules))] didn't introduce new warnings on stable in a module.

Meta

This happens in at least:

  • 1.60.0
  • 1.61.0-beta.7
  • nightly-2022-05-15

which are the versions currently on the playground

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions