Skip to content

Regression in non_upper_case_globals lint level attribute on associated item #110573

Closed
@dtolnay

Description

@dtolnay
#![deny(warnings)]

pub struct Struct;

impl Struct {
    #[allow(non_upper_case_globals)]
    pub const Const: () = ();
}
$ cargo +nightly-2023-04-19 check
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
$ cargo +nightly-2023-04-20 check
error: associated constant `Const` should have an upper case name
 --> src/main.rs:7:15
  |
7 |     pub const Const: () = ();
  |               ^^^^^ help: convert the identifier to upper case: `CONST`
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![deny(warnings)]
  |         ^^^^^^^^
  = note: `#[deny(non_upper_case_globals)]` implied by `#[deny(warnings)]`

I believe the old behavior from nightly-2023-04-19 is correct.

The repro has nothing to do with trait impls so I believe #110513 was not supposed to have affected it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions