diff options
| author | Smitty <me@smitop.com> | 2021-02-06 19:17:14 -0500 |
|---|---|---|
| committer | Smitty <me@smitop.com> | 2021-02-06 19:17:14 -0500 |
| commit | 651d289405b9d48005a3e6a14f0f76a792d60c5f (patch) | |
| tree | 5e163d11545725dad2bc610c231d401648904edd /compiler/rustc_parse/src/lexer/mod.rs | |
| parent | 5605b5d693ac0aba5b506923e3e99ec927969d04 (diff) | |
| download | rust-651d289405b9d48005a3e6a14f0f76a792d60c5f.tar.gz rust-651d289405b9d48005a3e6a14f0f76a792d60c5f.zip | |
Add note about encoding when null bytes found
Diffstat (limited to 'compiler/rustc_parse/src/lexer/mod.rs')
| -rw-r--r-- | compiler/rustc_parse/src/lexer/mod.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 4a638ec3f80..bb63dbd5303 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -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? } |
