-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #87659 - FabianWolff:issue-87397, r=davidtwco
Fix invalid suggestions for non-ASCII characters in byte constants Fixes #87397.
- Loading branch information
Showing
6 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Regression test for #87397. | ||
|
||
fn main() { | ||
b'µ'; | ||
//~^ ERROR: non-ASCII character in byte constant | ||
//~| HELP: if you meant to use the unicode code point for 'µ', use a \xHH escape | ||
//~| NOTE: byte constant must be ASCII | ||
|
||
b'字'; | ||
//~^ ERROR: non-ASCII character in byte constant | ||
//~| NOTE: this multibyte character does not fit into a single byte | ||
//~| NOTE: byte constant must be ASCII | ||
|
||
b"字"; | ||
//~^ ERROR: non-ASCII character in byte constant | ||
//~| HELP: if you meant to use the UTF-8 encoding of '字', use \xHH escapes | ||
//~| NOTE: byte constant must be ASCII | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
error: non-ASCII character in byte constant | ||
--> $DIR/multibyte-escapes.rs:4:7 | ||
| | ||
LL | b'µ'; | ||
| ^ byte constant must be ASCII | ||
| | ||
help: if you meant to use the unicode code point for 'µ', use a \xHH escape | ||
| | ||
LL | b'\xB5'; | ||
| ^^^^ | ||
|
||
error: non-ASCII character in byte constant | ||
--> $DIR/multibyte-escapes.rs:9:7 | ||
| | ||
LL | b'字'; | ||
| ^^ | ||
| | | ||
| byte constant must be ASCII | ||
| this multibyte character does not fit into a single byte | ||
|
||
error: non-ASCII character in byte constant | ||
--> $DIR/multibyte-escapes.rs:14:7 | ||
| | ||
LL | b"字"; | ||
| ^^ byte constant must be ASCII | ||
| | ||
help: if you meant to use the UTF-8 encoding of '字', use \xHH escapes | ||
| | ||
LL | b"\xE5\xAD\x97"; | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|