Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in non_upper_case_globals lint level attribute on associated item #110573

Closed
dtolnay opened this issue Apr 20, 2023 · 5 comments · Fixed by #110575
Closed

Regression in non_upper_case_globals lint level attribute on associated item #110573

dtolnay opened this issue Apr 20, 2023 · 5 comments · Fixed by #110575
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented Apr 20, 2023

#![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.

@dtolnay dtolnay added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Apr 20, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Apr 20, 2023
@dtolnay dtolnay added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-untriaged Untriaged performance or correctness regression. labels Apr 20, 2023
@dtolnay
Copy link
Member Author

dtolnay commented Apr 20, 2023

Bisects to #110513. @Ezrashaw @compiler-errors

@Ezrashaw
Copy link
Contributor

Ezrashaw commented Apr 20, 2023

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

EDIT: got a fix, will post soon.

dtolnay added a commit to dtolnay/reflect that referenced this issue Apr 20, 2023
@compiler-errors
Copy link
Member

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.

@Ezrashaw
Copy link
Contributor

Ezrashaw commented Apr 20, 2023

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.

@compiler-errors
Copy link
Member

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

@apiraino apiraino added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 20, 2023
@bors bors closed this as completed in a2826dc Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants