mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-31 23:38:45 +00:00
Merge #398
398: Fix the same bug as #396 but for bytes too r=matklad a=DJMcNab #396 Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
This commit is contained in:
commit
f2ab971cb0
2 changed files with 4 additions and 1 deletions
|
@ -88,7 +88,9 @@ fn validate_byte_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxErr
|
||||||
|
|
||||||
fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) {
|
fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) {
|
||||||
// A ByteCodeEscape has 4 chars, example: `\xDD`
|
// A ByteCodeEscape has 4 chars, example: `\xDD`
|
||||||
if text.len() < 4 {
|
if !text.is_ascii() {
|
||||||
|
errors.push(SyntaxError::new(MalformedByteCodeEscape, range));
|
||||||
|
} else if text.chars().count() < 4 {
|
||||||
errors.push(SyntaxError::new(TooShortByteCodeEscape, range));
|
errors.push(SyntaxError::new(TooShortByteCodeEscape, range));
|
||||||
} else {
|
} else {
|
||||||
assert!(
|
assert!(
|
||||||
|
|
1
crates/ra_syntax/tests/data/parser/fuzz-failures/0004.rs
Normal file
1
crates/ra_syntax/tests/data/parser/fuzz-failures/0004.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
b"\xʿ
|
Loading…
Reference in a new issue