diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/validation/byte.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/validation/byte.rs b/crates/ra_syntax/src/validation/byte.rs index d0897eeed..714224b09 100644 --- a/crates/ra_syntax/src/validation/byte.rs +++ b/crates/ra_syntax/src/validation/byte.rs | |||
@@ -88,7 +88,9 @@ fn validate_byte_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxErr | |||
88 | 88 | ||
89 | fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) { | 89 | fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) { |
90 | // A ByteCodeEscape has 4 chars, example: `\xDD` | 90 | // A ByteCodeEscape has 4 chars, example: `\xDD` |
91 | if text.len() < 4 { | 91 | if !text.is_ascii() { |
92 | errors.push(SyntaxError::new(MalformedByteCodeEscape, range)); | ||
93 | } else if text.chars().count() < 4 { | ||
92 | errors.push(SyntaxError::new(TooShortByteCodeEscape, range)); | 94 | errors.push(SyntaxError::new(TooShortByteCodeEscape, range)); |
93 | } else { | 95 | } else { |
94 | assert!( | 96 | assert!( |