File tree Expand file tree Collapse file tree 5 files changed +15
-11
lines changed
tests/ui/lint/rfc-2457-non-ascii-idents Expand file tree Collapse file tree 5 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -166,8 +166,9 @@ lint_check_name_warning = {$msg}
166166
167167lint_command_line_source = `forbid` lint level was set on command line
168168
169- lint_confusable_identifier_pair = identifier pair considered confusable between `{ $existing_sym } ` and `{ $sym } `
170- .label = this is where the previous identifier occurred
169+ lint_confusable_identifier_pair = found both `{ $existing_sym } ` and `{ $sym } ` as identifiers, which look alike
170+ .current_use = this identifier can be confused with `{ $existing_sym } `
171+ .other_use = other identifier used here
171172
172173lint_cstring_ptr = getting the inner pointer of a temporary `CString`
173174 .as_ptr_label = this pointer will be invalid
Original file line number Diff line number Diff line change @@ -1056,8 +1056,10 @@ pub struct IdentifierUncommonCodepoints;
10561056pub struct ConfusableIdentifierPair {
10571057 pub existing_sym : Symbol ,
10581058 pub sym : Symbol ,
1059- #[ label]
1059+ #[ label( lint_other_use ) ]
10601060 pub label : Span ,
1061+ #[ label( lint_current_use) ]
1062+ pub main_label : Span ,
10611063}
10621064
10631065#[ derive( LintDiagnostic ) ]
Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ impl EarlyLintPass for NonAsciiIdents {
222222 existing_sym : * existing_symbol,
223223 sym : symbol,
224224 label : * existing_span,
225+ main_label : sp,
225226 } ,
226227 ) ;
227228 }
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ const s: usize = 42;
55const s_s: usize = 42 ;
66
77fn main ( ) {
8- let s = "rust" ; //~ ERROR identifier pair considered confusable
9- let s_s = "rust2" ; //~ ERROR identifier pair considered confusable
8+ let s = "rust" ; //~ ERROR found both
9+ let s_s = "rust2" ; //~ ERROR found both
1010 not_affected ( ) ;
1111}
1212
Original file line number Diff line number Diff line change 1- error: identifier pair considered confusable between `s` and `s`
1+ error: found both `s` and `s` as identifiers, which look alike
22 --> $DIR/lint-confusable-idents.rs:8:9
33 |
44LL | const s: usize = 42;
5- | -- this is where the previous identifier occurred
5+ | -- other identifier used here
66...
77LL | let s = "rust";
8- | ^
8+ | ^ this identifier can be confused with `s`
99 |
1010note: the lint level is defined here
1111 --> $DIR/lint-confusable-idents.rs:1:9
1212 |
1313LL | #![deny(confusable_idents)]
1414 | ^^^^^^^^^^^^^^^^^
1515
16- error: identifier pair considered confusable between `s_s` and `s_s`
16+ error: found both `s_s` and `s_s` as identifiers, which look alike
1717 --> $DIR/lint-confusable-idents.rs:9:9
1818 |
1919LL | const s_s: usize = 42;
20- | --- this is where the previous identifier occurred
20+ | --- other identifier used here
2121...
2222LL | let s_s = "rust2";
23- | ^^^^^
23+ | ^^^^^ this identifier can be confused with `s_s`
2424
2525error: aborting due to 2 previous errors
2626
You can’t perform that action at this time.
0 commit comments