Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ impl<'a> StringReader<'a> {
// tokens like `<<` from `rustc_lexer`, and then add fancier error recovery to it,
// as there will be less overall work to do this way.
let token = unicode_chars::check_for_substitution(self, start, c, &mut err);
if c == '\x00' {
err.help("source files must be encoded in UTF-8, unexpected null bytes might occur when the wrong text encoding is used");
}
err.emit();
token?
}
Expand Down
Binary file modified src/test/ui/parser/issue-66473.stderr
Binary file not shown.
Binary file modified src/test/ui/parser/issue-68629.stderr
Binary file not shown.
Binary file modified src/test/ui/parser/issue-68730.stderr
Binary file not shown.
Binary file added src/test/ui/parser/utf16-be-without-bom.rs
Binary file not shown.
Binary file added src/test/ui/parser/utf16-be-without-bom.stderr
Binary file not shown.
Binary file added src/test/ui/parser/utf16-le-without-bom.rs
Binary file not shown.
Binary file added src/test/ui/parser/utf16-le-without-bom.stderr
Binary file not shown.