diff options
| author | Skynoodle <iainrobert.maciver@gmail.com> | 2021-01-02 15:46:41 +0000 |
|---|---|---|
| committer | Skynoodle <iainrobert.maciver@gmail.com> | 2021-01-02 15:46:41 +0000 |
| commit | 750c52af7334e325e9c3980dbdad10dedeb22f82 (patch) | |
| tree | 9ee899497e1feae7d71fa728df9d7f1ddc7c549f | |
| parent | 91f436b456130561d514c5e7050486cb0768996f (diff) | |
| download | rust-750c52af7334e325e9c3980dbdad10dedeb22f82.tar.gz rust-750c52af7334e325e9c3980dbdad10dedeb22f82.zip | |
Add snake case lint note about keyword identifiers which cannot be raw
| -rw-r--r-- | compiler/rustc_lint/src/nonstandard_style.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-non-snake-case-identifiers-suggestion-reserved.stderr | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs index 39cebe7f969..8bb3ff0dde0 100644 --- a/compiler/rustc_lint/src/nonstandard_style.rs +++ b/compiler/rustc_lint/src/nonstandard_style.rs @@ -283,6 +283,7 @@ impl NonSnakeCase { if sc_ident.name.can_be_raw() { ("rename the identifier or convert it to a snake case raw identifier", sc_ident.to_string()) } else { + err.note(&format!("`{}` cannot be used as a raw identifier", sc)); ("rename the identifier", String::new()) } } else { diff --git a/src/test/ui/lint/lint-non-snake-case-identifiers-suggestion-reserved.stderr b/src/test/ui/lint/lint-non-snake-case-identifiers-suggestion-reserved.stderr index d2618773f6b..c179f4a25bd 100644 --- a/src/test/ui/lint/lint-non-snake-case-identifiers-suggestion-reserved.stderr +++ b/src/test/ui/lint/lint-non-snake-case-identifiers-suggestion-reserved.stderr @@ -60,6 +60,8 @@ error: variable `Super` should have a snake case name | LL | let Super: usize = 0; | ^^^^^ help: rename the identifier + | + = note: `super` cannot be used as a raw identifier error: aborting due to 4 previous errors; 2 warnings emitted |
