@@ -179,8 +179,11 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[
179
179
180
180
" rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
181
181
syn match rustLifetime display " \'\% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\% ([^[:cntrl:][:punct:][:space:]]\| _\) *"
182
- syn match rustCharacter / b'\( [^'\\ ]\|\\\( .\| x\x\{ 2}\)\) '/ contains =rustEscape,rustEscapeError
183
- syn match rustCharacter / '\( [^'\\ ]\|\\\( .\| x\x\{ 2}\| u\x\{ 4}\| U\x\{ 8}\)\) '/ contains =rustEscape,rustEscapeUnicode,rustEscapeError
182
+ syn match rustCharacterInvalid display contained / b\? '\z s[\n\r\t ']\z e'/
183
+ " The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII).
184
+ syn match rustCharacterInvalidUnicode display contained / b'\z s[^[:cntrl:][:graph:][:alnum:][:space:]]\z e'/
185
+ syn match rustCharacter / b'\( [^\\ ]\|\\\( .\| x\x\{ 2}\)\) '/ contains =rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode
186
+ syn match rustCharacter / '\( [^\\ ]\|\\\( .\| x\x\{ 2}\| u\x\{ 4}\| U\x\{ 8}\)\) '/ contains =rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid
184
187
185
188
syn region rustCommentLine start =" //" end =" $" contains =rustTodo,@Spell
186
189
syn region rustCommentLineDoc start =" //\% (//\@ !\| !\) " end =" $" contains =rustTodo,@Spell
@@ -223,6 +226,8 @@ hi def link rustEscapeUnicode rustEscape
223
226
hi def link rustEscapeError Error
224
227
hi def link rustStringContinuation Special
225
228
hi def link rustString String
229
+ hi def link rustCharacterInvalid Error
230
+ hi def link rustCharacterInvalidUnicode rustCharacterInvalid
226
231
hi def link rustCharacter Character
227
232
hi def link rustNumber Number
228
233
hi def link rustBoolean Boolean
0 commit comments