This repository was archived by the owner on May 28, 2025. It is now read-only.
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 @@ -167,8 +167,9 @@ lint_check_name_warning = {$msg}
167167
168168lint_command_line_source = `forbid` lint level was set on command line
169169
170- lint_confusable_identifier_pair = identifier pair considered confusable between `{ $existing_sym } ` and `{ $sym } `
171- .label = this is where the previous identifier occurred
170+ lint_confusable_identifier_pair = found both `{ $existing_sym } ` and `{ $sym } ` as identifiers, which look alike
171+ .current_use = this identifier can be confused with `{ $existing_sym } `
172+ .other_use = other identifier used here
172173
173174lint_cstring_ptr = getting the inner pointer of a temporary `CString`
174175 .as_ptr_label = this pointer will be invalid
Original file line number Diff line number Diff line change @@ -1083,8 +1083,10 @@ pub struct IdentifierUncommonCodepoints;
10831083pub struct ConfusableIdentifierPair {
10841084 pub existing_sym : Symbol ,
10851085 pub sym : Symbol ,
1086- #[ label]
1086+ #[ label( lint_other_use ) ]
10871087 pub label : Span ,
1088+ #[ label( lint_current_use) ]
1089+ pub main_label : Span ,
10881090}
10891091
10901092#[ 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