forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for source code with invalid utf-8 bytes
``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: byte `193` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` CC rust-lang#76869, rust-lang#135557.
- Loading branch information
Showing
4 changed files
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//@ error-pattern: did not contain valid UTF-8 | ||
//@ reference: input.encoding.utf8 | ||
//@ reference: input.encoding.invalid | ||
|
||
fn foo() { | ||
include!("not-utf8-bin-file.rs"); | ||
} |
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,15 @@ | ||
error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 | ||
--> $DIR/not-utf8-2.rs:6:5 | ||
| | ||
LL | include!("not-utf8-bin-file.rs"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: byte `193` is not valid utf-8 | ||
--> $DIR/not-utf8-bin-file.rs:2:14 | ||
| | ||
LL | let _ = "�|�␂!5�cc␕␂��"; | ||
| ^ | ||
= note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 1 previous error | ||
|
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,4 @@ | ||
fn main() { | ||
let _ = "Á|Õ!5¢ccŒÓ"; | ||
//~^ ERROR stream did not contain valid UTF-8 | ||
} |
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,8 @@ | ||
error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 | ||
--> $DIR/not-utf8-bin-file.rs:2:14 | ||
| | ||
LL | let _ = "�|�␂!5�cc␕␂��"; | ||
| ^ byte `193` is not valid utf-8 | ||
|
||
error: aborting due to 1 previous error | ||
|