]> git.lizzy.rs Git - rust.git/commitdiff
Add snake case lint note about keyword identifiers which cannot be raw
authorSkynoodle <iainrobert.maciver@gmail.com>
Sat, 2 Jan 2021 15:46:41 +0000 (15:46 +0000)
committerSkynoodle <iainrobert.maciver@gmail.com>
Sat, 2 Jan 2021 15:46:41 +0000 (15:46 +0000)
compiler/rustc_lint/src/nonstandard_style.rs
src/test/ui/lint/lint-non-snake-case-identifiers-suggestion-reserved.stderr

index 39cebe7f969368dbea328e7e485cd54b690d4a4e..8bb3ff0dde014aeb79883aa0517ebbb532e430c1 100644 (file)
@@ -283,6 +283,7 @@ fn is_snake_case(ident: &str) -> bool {
                             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 {
index d2618773f6b9fc6ae5640ffa5fed7b77c63c3530..c179f4a25bdd2290da656a8b1d55a3082ff4dd8d 100644 (file)
@@ -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