diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2024-01-25 06:40:07 +0200 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2024-01-25 06:40:07 +0200 |
| commit | b1b6e0c41a09cdcfbd8a731e5489eb56df33d7cc (patch) | |
| tree | 0576d05759c05be522adee19aeff94aac50df96d | |
| parent | 0d52934d19d7addcafcfda92a1d547b51556beec (diff) | |
| download | rust-b1b6e0c41a09cdcfbd8a731e5489eb56df33d7cc.tar.gz rust-b1b6e0c41a09cdcfbd8a731e5489eb56df33d7cc.zip | |
Reapply "Detect `NulInCStr` error earlier."
This reverts commit 0ea056552a014a09b7aed40358f05c0676460af5.
| -rw-r--r-- | crates/parser/src/lexed_str.rs | 1 | ||||
| -rw-r--r-- | crates/syntax/src/validation.rs | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/crates/parser/src/lexed_str.rs b/crates/parser/src/lexed_str.rs index f47ec49df1d..aa25f82ae1d 100644 --- a/crates/parser/src/lexed_str.rs +++ b/crates/parser/src/lexed_str.rs @@ -369,6 +369,7 @@ fn error_to_diagnostic_message(error: EscapeError, mode: Mode) -> &'static str { "non-ASCII character in byte string literal" } EscapeError::NonAsciiCharInByte => "non-ASCII character in raw byte string literal", + EscapeError::NulInCStr => "null character in C string literal", EscapeError::UnskippedWhitespaceWarning => "", EscapeError::MultipleSkippedLinesWarning => "", } diff --git a/crates/syntax/src/validation.rs b/crates/syntax/src/validation.rs index 6c6916c585f..69dffbf79f1 100644 --- a/crates/syntax/src/validation.rs +++ b/crates/syntax/src/validation.rs @@ -106,6 +106,9 @@ fn rustc_unescape_error_to_string(err: unescape::EscapeError) -> (&'static str, EE::NonAsciiCharInByte => { "Byte literals must not contain non-ASCII characters" } + EE::NulInCStr => { + "C strings literals must not contain null characters" + } EE::UnskippedWhitespaceWarning => "Whitespace after this escape is not skipped", EE::MultipleSkippedLinesWarning => "Multiple lines are skipped by this escape", |
