Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b1b6e0c

Browse files
committed
Reapply "Detect NulInCStr error earlier."
This reverts commit 0ea0565.
1 parent 0d52934 commit b1b6e0c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

crates/parser/src/lexed_str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ fn error_to_diagnostic_message(error: EscapeError, mode: Mode) -> &'static str {
369369
"non-ASCII character in byte string literal"
370370
}
371371
EscapeError::NonAsciiCharInByte => "non-ASCII character in raw byte string literal",
372+
EscapeError::NulInCStr => "null character in C string literal",
372373
EscapeError::UnskippedWhitespaceWarning => "",
373374
EscapeError::MultipleSkippedLinesWarning => "",
374375
}

crates/syntax/src/validation.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ fn rustc_unescape_error_to_string(err: unescape::EscapeError) -> (&'static str,
106106
EE::NonAsciiCharInByte => {
107107
"Byte literals must not contain non-ASCII characters"
108108
}
109+
EE::NulInCStr => {
110+
"C strings literals must not contain null characters"
111+
}
109112
EE::UnskippedWhitespaceWarning => "Whitespace after this escape is not skipped",
110113
EE::MultipleSkippedLinesWarning => "Multiple lines are skipped by this escape",
111114

0 commit comments

Comments
 (0)