This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,7 @@ E0762: include_str!("./error_codes/E0762.md"),
446
446
E0763 : include_str!( "./error_codes/E0763.md" ) ,
447
447
E0764 : include_str!( "./error_codes/E0764.md" ) ,
448
448
E0765 : include_str!( "./error_codes/E0765.md" ) ,
449
+ E0766 : include_str!( "./error_codes/E0766.md" ) ,
449
450
;
450
451
// E0006, // merged with E0005
451
452
// E0008, // cannot bind by-move into a pattern guard
Original file line number Diff line number Diff line change
1
+ A double quote byte string (` b" ` ) was not terminated.
2
+
3
+ Erroneous code example:
4
+
5
+ ``` compile_fail,E0766
6
+ let s = b"; // error!
7
+ ```
8
+
9
+ To fix this error, add the missing double quote at the end of the string:
10
+
11
+ ```
12
+ let s = b""; // ok!
13
+ ```
Original file line number Diff line number Diff line change @@ -367,12 +367,15 @@ impl<'a> StringReader<'a> {
367
367
}
368
368
rustc_lexer:: LiteralKind :: ByteStr { terminated } => {
369
369
if !terminated {
370
- self . fatal_span_ (
371
- start + BytePos ( 1 ) ,
372
- suffix_start,
373
- "unterminated double quote byte string" ,
374
- )
375
- . raise ( )
370
+ self . sess
371
+ . span_diagnostic
372
+ . struct_span_fatal_with_code (
373
+ self . mk_sp ( start + BytePos ( 1 ) , suffix_start) ,
374
+ "unterminated double quote byte string" ,
375
+ error_code ! ( E0766 ) ,
376
+ )
377
+ . emit ( ) ;
378
+ FatalError . raise ( ) ;
376
379
}
377
380
( token:: ByteStr , Mode :: ByteStr , 2 , 1 ) // b" "
378
381
}
You can’t perform that action at this time.
0 commit comments