Skip to content

Commit 750c52a

Browse files
committed
Add snake case lint note about keyword identifiers which cannot be raw
1 parent 91f436b commit 750c52a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

compiler/rustc_lint/src/nonstandard_style.rs

+1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ impl NonSnakeCase {
283283
if sc_ident.name.can_be_raw() {
284284
("rename the identifier or convert it to a snake case raw identifier", sc_ident.to_string())
285285
} else {
286+
err.note(&format!("`{}` cannot be used as a raw identifier", sc));
286287
("rename the identifier", String::new())
287288
}
288289
} else {

src/test/ui/lint/lint-non-snake-case-identifiers-suggestion-reserved.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ error: variable `Super` should have a snake case name
6060
|
6161
LL | let Super: usize = 0;
6262
| ^^^^^ help: rename the identifier
63+
|
64+
= note: `super` cannot be used as a raw identifier
6365

6466
error: aborting due to 4 previous errors; 2 warnings emitted
6567

0 commit comments

Comments
 (0)