Skip to content

Commit e290582

Browse files
committed
Identify impossible cases in ascii_escapes_should_be_ascii.
Raw strings (of all kinds) don't support escapes, so this function should never be called on them.
1 parent 856b55f commit e290582

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_lexer/src/unescape.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ impl Mode {
169169
/// Non-byte literals should have `\xXX` escapes that are within the ASCII range.
170170
fn ascii_escapes_should_be_ascii(self) -> bool {
171171
match self {
172-
Mode::Char | Mode::Str | Mode::RawStr => true,
173-
Mode::Byte | Mode::ByteStr | Mode::RawByteStr | Mode::CStr | Mode::RawCStr => false,
172+
Mode::Char | Mode::Str => true,
173+
Mode::Byte | Mode::ByteStr | Mode::CStr => false,
174+
Mode::RawStr | Mode::RawByteStr | Mode::RawCStr => unreachable!(),
174175
}
175176
}
176177

0 commit comments

Comments
 (0)