Skip to content

Commit 2f6e822

Browse files
committed
add note
1 parent de88a4d commit 2f6e822

File tree

5 files changed

+35
-12
lines changed

5 files changed

+35
-12
lines changed

Diff for: compiler/rustc_lint/messages.ftl

+24-8
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,36 @@ lint_identifier_non_ascii_char = identifier contains non-ASCII characters
242242
243243
lint_identifier_uncommon_codepoints = identifier contains {$codepoints_len ->
244244
[one] { $identifier_type ->
245-
[Exclusion] an {$identifier_type} Unicode codepoint
246-
[Technical] a {$identifier_type} Unicode codepoint
247-
[Limited_Use] a {$identifier_type} Unicode codepoint
248-
[Not_NFKC] a {$identifier_type} Unicode codepoint
245+
[Exclusion] a Unicode codepoint that is no longer used
246+
[Technical] a Unicode codepoint that has specialized usage
247+
[Limited_Use] a Unicode codepoint that is in limited use
248+
[Not_NFKC] a Unicode codepoint that is not used in normalized strings
249249
*[other] an uncommon Unicode codepoint
250250
}
251251
*[other] { $identifier_type ->
252-
[Exclusion] {$identifier_type} Unicode codepoints
253-
[Technical] {$identifier_type} Unicode codepoints
254-
[Limited_Use] {$identifier_type} Unicode codepoints
255-
[Not_NFKC] {$identifier_type} Unicode codepoints
252+
[Exclusion] {$codepoints_len} Unicode codepoints that are no longer used
253+
[Technical] {$codepoints_len} Unicode codepoints that have specialized usage
254+
[Limited_Use] {$codepoints_len} Unicode codepoints that are in limited use
255+
[Not_NFKC] {$codepoints_len} Unicode codepoints that are not used in normalized strings
256256
*[other] uncommon Unicode codepoints
257257
}
258258
}: {$codepoints}
259+
.note = {$codepoints_len ->
260+
[one] { $identifier_type ->
261+
[Exclusion] this character is included in the {$identifier_type} Unicode general security profile
262+
[Technical] this character is included in the {$identifier_type} Unicode general security profile
263+
[Limited_Use] this character is included in the {$identifier_type} Unicode general security profile
264+
[Not_NFKC] this character is included in the {$identifier_type} Unicode general security profile
265+
*[other] this Unicode codepoint is uncommon
266+
}
267+
*[other] { $identifier_type ->
268+
[Exclusion] these characters are included in the {$identifier_type} Unicode general security profile
269+
[Technical] these characters are included in the {$identifier_type} Unicode general security profile
270+
[Limited_Use] these characters are included in the {$identifier_type} Unicode general security profile
271+
[Not_NFKC] these characters are included in the {$identifier_type} Unicode general security profile
272+
*[other] these Unicode codepoints are uncommon
273+
}
274+
}
259275
260276
lint_ignored_unless_crate_specified = {$level}({$name}) is ignored unless specified at crate level
261277

Diff for: compiler/rustc_lint/src/lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,7 @@ pub struct IdentifierNonAsciiChar;
10861086

10871087
#[derive(LintDiagnostic)]
10881088
#[diag(lint_identifier_uncommon_codepoints)]
1089+
#[note]
10891090
pub struct IdentifierUncommonCodepoints {
10901091
pub codepoints: Vec<char>,
10911092
pub codepoints_len: usize,

Diff for: tests/ui/lexer/lex-emoji-identifiers.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ warning: identifier contains an uncommon Unicode codepoint: '\u{fe0f}'
4646
LL | let key1️⃣ = "keycap sequence";
4747
| ^^^^
4848
|
49+
= note: this Unicode codepoint is uncommon
4950
= note: `#[warn(uncommon_codepoints)]` on by default
5051

5152
error: aborting due to 7 previous errors; 1 warning emitted

Diff for: tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![deny(uncommon_codepoints)]
22

3-
const µ: f64 = 0.000001; //~ ERROR identifier contains a Not_NFKC Unicode codepoint: 'µ'
3+
const µ: f64 = 0.000001; //~ identifier contains a Unicode codepoint that is not used in normalized strings: 'µ'
44
//~| WARNING should have an upper case name
55

66
fn dijkstra() {}
7-
//~^ ERROR identifier contains a Not_NFKC Unicode codepoint: 'ij'
7+
//~^ ERROR identifier contains a Unicode codepoint that is not used in normalized strings: 'ij'
88

99
fn main() {
1010
let ㇻㇲㇳ = "rust"; //~ ERROR identifier contains uncommon Unicode codepoints

Diff for: tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
1-
error: identifier contains a Not_NFKC Unicode codepoint: 'µ'
1+
error: identifier contains a Unicode codepoint that is not used in normalized strings: 'µ'
22
--> $DIR/lint-uncommon-codepoints.rs:3:7
33
|
44
LL | const µ: f64 = 0.000001;
55
| ^
66
|
7+
= note: this character is included in the Not_NFKC Unicode general security profile
78
note: the lint level is defined here
89
--> $DIR/lint-uncommon-codepoints.rs:1:9
910
|
1011
LL | #![deny(uncommon_codepoints)]
1112
| ^^^^^^^^^^^^^^^^^^^
1213

13-
error: identifier contains a Not_NFKC Unicode codepoint: 'ij'
14+
error: identifier contains a Unicode codepoint that is not used in normalized strings: 'ij'
1415
--> $DIR/lint-uncommon-codepoints.rs:6:4
1516
|
1617
LL | fn dijkstra() {}
1718
| ^^^^^^^
19+
|
20+
= note: this character is included in the Not_NFKC Unicode general security profile
1821

1922
error: identifier contains uncommon Unicode codepoints: 'ㇻ', 'ㇲ', and 'ㇳ'
2023
--> $DIR/lint-uncommon-codepoints.rs:10:9
2124
|
2225
LL | let ㇻㇲㇳ = "rust";
2326
| ^^^^^^
27+
|
28+
= note: these Unicode codepoints are uncommon
2429

2530
warning: constant `µ` should have an upper case name
2631
--> $DIR/lint-uncommon-codepoints.rs:3:7

0 commit comments

Comments
 (0)