From 0ddeb3b824dcabc2b3a99feb0be036782fa56fee Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Tue, 1 Jan 2019 12:10:21 +0000 Subject: Fix the same bug as #396 but for bytes too --- crates/ra_syntax/src/validation/byte.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src') 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) { // 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)); } else { assert!( -- cgit v1.2.3