File tree 5 files changed +15
-11
lines changed
tests/ui/lint/rfc-2457-non-ascii-idents
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}
167
167
168
168
lint_command_line_source = `forbid` lint level was set on command line
169
169
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
172
173
173
174
lint_cstring_ptr = getting the inner pointer of a temporary `CString`
174
175
.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;
1083
1083
pub struct ConfusableIdentifierPair {
1084
1084
pub existing_sym : Symbol ,
1085
1085
pub sym : Symbol ,
1086
- #[ label]
1086
+ #[ label( lint_other_use ) ]
1087
1087
pub label : Span ,
1088
+ #[ label( lint_current_use) ]
1089
+ pub main_label : Span ,
1088
1090
}
1089
1091
1090
1092
#[ derive( LintDiagnostic ) ]
Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ impl EarlyLintPass for NonAsciiIdents {
222
222
existing_sym : * existing_symbol,
223
223
sym : symbol,
224
224
label : * existing_span,
225
+ main_label : sp,
225
226
} ,
226
227
) ;
227
228
}
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ const s: usize = 42;
5
5
const s_s: usize = 42 ;
6
6
7
7
fn 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
10
10
not_affected ( ) ;
11
11
}
12
12
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
2
2
--> $DIR/lint-confusable-idents.rs:8:9
3
3
|
4
4
LL | const s: usize = 42;
5
- | -- this is where the previous identifier occurred
5
+ | -- other identifier used here
6
6
...
7
7
LL | let s = "rust";
8
- | ^
8
+ | ^ this identifier can be confused with `s`
9
9
|
10
10
note: the lint level is defined here
11
11
--> $DIR/lint-confusable-idents.rs:1:9
12
12
|
13
13
LL | #![deny(confusable_idents)]
14
14
| ^^^^^^^^^^^^^^^^^
15
15
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
17
17
--> $DIR/lint-confusable-idents.rs:9:9
18
18
|
19
19
LL | const s_s: usize = 42;
20
- | --- this is where the previous identifier occurred
20
+ | --- other identifier used here
21
21
...
22
22
LL | let s_s = "rust2";
23
- | ^^^^^
23
+ | ^^^^^ this identifier can be confused with `s_s`
24
24
25
25
error: aborting due to 2 previous errors
26
26
You can’t perform that action at this time.
0 commit comments