Skip to content

Commit d8e2f51

Browse files
committed
Don't accept unicode escapes without curly braces.
At least with Rust 1.5, putting a 4-digit Unicode escape into a string literal produces an error message: src/cells.rs:81:19: 81:21 error: incorrect unicode escape sequence src/cells.rs:81 (1, "e\u0301"), ^~ src/cells.rs:81:19: 81:21 help: format of unicode escape sequences is `\u{…}` src/cells.rs:81 (1, "e\u0301"), ...and a six-digit Unicode escape (`\Uxxxxxx`) just produces: src/cells.rs:81:20: 81:21 error: unknown character escape: U The only supported Unicode escape sequence is `\u` followed by hex digits in curly braces, so that's the only format the Vim syntax highlighting should accept.
1 parent 2fa3e21 commit d8e2f51

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

syntax/rust.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic
125125

126126
syn match rustEscapeError display contained /\\./
127127
syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/
128-
syn match rustEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{8}\)/
129128
syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/
130129
syn match rustStringContinuation display contained /\\\n\s*/
131130
syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation

0 commit comments

Comments
 (0)