Skip to content

Regression in non_upper_case_globals lint level attribute on associated item #110573

Closed

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.

Activity

  1. added
    C-bugCategory: This is a bug.
    regression-untriagedUntriaged performance or correctness regression.
    on Apr 20, 2023
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Apr 20, 2023
  3. added and removed
    regression-untriagedUntriaged performance or correctness regression.
    on Apr 20, 2023
  4. dtolnay commented on Apr 20, 2023

    @dtolnay
    MemberAuthor
  5. Ezrashaw commented on Apr 20, 2023

    @Ezrashaw
    Contributor

    How on earth did that happen? It was like a five-line change. 😆

    EDIT: got a fix, will post soon.

  6. compiler-errors commented on Apr 20, 2023

    @compiler-errors
    Contributor

    Probably something to do with the hygeine of the span on the ImplItemRef versus the ImplItem. @Ezrashaw if you can't fix this then ping me and I'll look at it, but we probably should fix it sooner than later.

  7. Ezrashaw commented on Apr 20, 2023

    @Ezrashaw
    Contributor

    I was thinking that it's because we aren't checking the lint level for each of the items within the impl. Just the impl itself. Actually, you're probably right.

  8. compiler-errors commented on Apr 20, 2023

    @compiler-errors
    Contributor

    Oh, no, that's not it. You're missing a call to with_lint_attrs in the visitor.

  9. added a commit that references this issue on Apr 20, 2023
    a2826dc
  10. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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