@@ -315,57 +315,41 @@ impl<'a> StringReader<'a> {
315
315
let ( lit_kind, mode, prefix_len, postfix_len) = match kind {
316
316
rustc_lexer:: LiteralKind :: Char { terminated } => {
317
317
if !terminated {
318
- self . sess
319
- . span_diagnostic
320
- . struct_span_fatal_with_code (
321
- self . mk_sp ( start, suffix_start) ,
322
- "unterminated character literal" ,
323
- error_code ! ( E0762 ) ,
324
- )
325
- . emit ( ) ;
326
- FatalError . raise ( ) ;
318
+ self . sess . span_diagnostic . span_fatal_with_code (
319
+ self . mk_sp ( start, suffix_start) ,
320
+ "unterminated character literal" ,
321
+ error_code ! ( E0762 ) ,
322
+ )
327
323
}
328
324
( token:: Char , Mode :: Char , 1 , 1 ) // ' '
329
325
}
330
326
rustc_lexer:: LiteralKind :: Byte { terminated } => {
331
327
if !terminated {
332
- self . sess
333
- . span_diagnostic
334
- . struct_span_fatal_with_code (
335
- self . mk_sp ( start + BytePos ( 1 ) , suffix_start) ,
336
- "unterminated byte constant" ,
337
- error_code ! ( E0763 ) ,
338
- )
339
- . emit ( ) ;
340
- FatalError . raise ( ) ;
328
+ self . sess . span_diagnostic . span_fatal_with_code (
329
+ self . mk_sp ( start + BytePos ( 1 ) , suffix_start) ,
330
+ "unterminated byte constant" ,
331
+ error_code ! ( E0763 ) ,
332
+ )
341
333
}
342
334
( token:: Byte , Mode :: Byte , 2 , 1 ) // b' '
343
335
}
344
336
rustc_lexer:: LiteralKind :: Str { terminated } => {
345
337
if !terminated {
346
- self . sess
347
- . span_diagnostic
348
- . struct_span_fatal_with_code (
349
- self . mk_sp ( start, suffix_start) ,
350
- "unterminated double quote string" ,
351
- error_code ! ( E0765 ) ,
352
- )
353
- . emit ( ) ;
354
- FatalError . raise ( ) ;
338
+ self . sess . span_diagnostic . span_fatal_with_code (
339
+ self . mk_sp ( start, suffix_start) ,
340
+ "unterminated double quote string" ,
341
+ error_code ! ( E0765 ) ,
342
+ )
355
343
}
356
344
( token:: Str , Mode :: Str , 1 , 1 ) // " "
357
345
}
358
346
rustc_lexer:: LiteralKind :: ByteStr { terminated } => {
359
347
if !terminated {
360
- self . sess
361
- . span_diagnostic
362
- . struct_span_fatal_with_code (
363
- self . mk_sp ( start + BytePos ( 1 ) , suffix_start) ,
364
- "unterminated double quote byte string" ,
365
- error_code ! ( E0766 ) ,
366
- )
367
- . emit ( ) ;
368
- FatalError . raise ( ) ;
348
+ self . sess . span_diagnostic . span_fatal_with_code (
349
+ self . mk_sp ( start + BytePos ( 1 ) , suffix_start) ,
350
+ "unterminated double quote byte string" ,
351
+ error_code ! ( E0766 ) ,
352
+ )
369
353
}
370
354
( token:: ByteStr , Mode :: ByteStr , 2 , 1 ) // b" "
371
355
}
0 commit comments