@@ -1305,28 +1305,29 @@ impl<'a> IntoDiagnostic<'a> for ExpectedSemi {
1305
1305
fn into_diagnostic ( self , dcx : & ' a DiagCtxt , level : Level ) -> DiagnosticBuilder < ' a > {
1306
1306
let token_descr = TokenDescription :: from_token ( & self . token ) ;
1307
1307
1308
- let mut diag = DiagnosticBuilder :: new (
1309
- dcx,
1310
- level,
1311
- match token_descr {
1312
- Some ( TokenDescription :: ReservedIdentifier ) => {
1313
- fluent:: parse_expected_semi_found_reserved_identifier_str
1314
- }
1315
- Some ( TokenDescription :: Keyword ) => fluent:: parse_expected_semi_found_keyword_str,
1316
- Some ( TokenDescription :: ReservedKeyword ) => {
1317
- fluent:: parse_expected_semi_found_reserved_keyword_str
1318
- }
1319
- Some ( TokenDescription :: DocComment ) => {
1320
- fluent:: parse_expected_semi_found_doc_comment_str
1321
- }
1322
- None => fluent:: parse_expected_semi_found_str,
1323
- } ,
1324
- ) ;
1308
+ let mut diag = handler. struct_diagnostic ( match token_descr {
1309
+ Some ( TokenDescription :: ReservedIdentifier ) => DiagnosticMessage :: Str ( Cow :: from (
1310
+ "expected `;`, found reserved identifier `{$token}`" ,
1311
+ ) ) ,
1312
+ Some ( TokenDescription :: Keyword ) => {
1313
+ DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found keyword `{$token}`" ) )
1314
+ }
1315
+ Some ( TokenDescription :: ReservedKeyword ) => {
1316
+ DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found reserved keyword `{$token}`" ) )
1317
+ }
1318
+ Some ( TokenDescription :: DocComment ) => {
1319
+ DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found doc comment `{$token}`" ) )
1320
+ }
1321
+ None => DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found `{$token}`" ) ) ,
1322
+ } ) ;
1325
1323
diag. set_span ( self . span ) ;
1326
1324
diag. set_arg ( "token" , self . token ) ;
1327
1325
1328
1326
if let Some ( unexpected_token_label) = self . unexpected_token_label {
1329
- diag. span_label ( unexpected_token_label, fluent:: parse_label_unexpected_token) ;
1327
+ diag. span_label (
1328
+ unexpected_token_label,
1329
+ DiagnosticMessage :: Str ( Cow :: from ( "unexpected token" ) ) ,
1330
+ ) ;
1330
1331
}
1331
1332
1332
1333
self . sugg . add_to_diagnostic ( & mut diag) ;
0 commit comments