forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#110513 - Ezrashaw:fix-trait-const-name-lint…
…, r=compiler-errors make `non_upper_case_globals` lint not report trait impls We should not lint on trait `impl`s for `non_upper_case_globals`; the user doesn't have control over the name. This brings `non_upper_case_globals` into consistency with other `nonstandard_style` lints.
- Loading branch information
Showing
3 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#![deny(non_upper_case_globals)] | ||
|
||
trait Trait { | ||
const item: usize; | ||
//~^ ERROR associated constant `item` should have an upper case name [non_upper_case_globals] | ||
} | ||
|
||
struct Foo; | ||
|
||
impl Trait for Foo { | ||
const item: usize = 5; | ||
// ^^^ there should be no error here (in the trait `impl`) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: associated constant `item` should have an upper case name | ||
--> $DIR/lint-non-uppercase-trait-assoc-const.rs:4:11 | ||
| | ||
LL | const item: usize; | ||
| ^^^^ help: convert the identifier to upper case: `ITEM` | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/lint-non-uppercase-trait-assoc-const.rs:1:9 | ||
| | ||
LL | #![deny(non_upper_case_globals)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|