@@ -11,7 +11,6 @@ use rustc_span::edition::{Edition, LATEST_STABLE_EDITION};
1111use rustc_span:: symbol:: Ident ;
1212use rustc_span:: { Span , Symbol } ;
1313
14- use crate :: fluent_generated as fluent;
1514use crate :: parser:: { ForbiddenLetReason , TokenDescription } ;
1615
1716#[ derive( Diagnostic ) ]
@@ -1206,16 +1205,18 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier {
12061205
12071206 let mut diag = handler. struct_diagnostic ( match token_descr {
12081207 Some ( TokenDescription :: ReservedIdentifier ) => {
1209- fluent :: parse_expected_identifier_found_reserved_identifier_str
1208+ "expected identifier, found reserved identifier `{$token}`"
12101209 }
1211- Some ( TokenDescription :: Keyword ) => fluent :: parse_expected_identifier_found_keyword_str ,
1210+ Some ( TokenDescription :: Keyword ) => "expected identifier, found keyword `{$token}`" ,
12121211 Some ( TokenDescription :: ReservedKeyword ) => {
1213- fluent :: parse_expected_identifier_found_reserved_keyword_str
1212+ "expected identifier, found reserved keyword `{$token}`"
12141213 }
1214+
12151215 Some ( TokenDescription :: DocComment ) => {
1216- fluent :: parse_expected_identifier_found_doc_comment_str
1216+ "expected identifier, found doc comment `{$token}`"
12171217 }
1218- None => fluent:: parse_expected_identifier_found_str,
1218+
1219+ None => "expected identifier, found `{$token}`" ,
12191220 } ) ;
12201221 diag. set_span ( self . span ) ;
12211222 diag. set_arg ( "token" , self . token ) ;
@@ -1262,28 +1263,21 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedSemi {
12621263 let token_descr = TokenDescription :: from_token ( & self . token ) ;
12631264
12641265 let mut diag = handler. struct_diagnostic ( match token_descr {
1265- Some ( TokenDescription :: ReservedIdentifier ) => DiagnosticMessage :: Str ( Cow :: from (
1266- "expected `;`, found reserved identifier `{$token}`" ,
1267- ) ) ,
1268- Some ( TokenDescription :: Keyword ) => {
1269- DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found keyword `{$token}`" ) )
1266+ Some ( TokenDescription :: ReservedIdentifier ) => {
1267+ "expected `;`, found reserved identifier `{$token}`"
12701268 }
1269+ Some ( TokenDescription :: Keyword ) => "expected `;`, found keyword `{$token}`" ,
12711270 Some ( TokenDescription :: ReservedKeyword ) => {
1272- DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found reserved keyword `{$token}`" ) )
1273- }
1274- Some ( TokenDescription :: DocComment ) => {
1275- DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found doc comment `{$token}`" ) )
1271+ "expected `;`, found reserved keyword `{$token}`"
12761272 }
1277- None => DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found `{$token}`" ) ) ,
1273+ Some ( TokenDescription :: DocComment ) => "expected `;`, found doc comment `{$token}`" ,
1274+ None => "expected `;`, found `{$token}`" ,
12781275 } ) ;
12791276 diag. set_span ( self . span ) ;
12801277 diag. set_arg ( "token" , self . token ) ;
12811278
12821279 if let Some ( unexpected_token_label) = self . unexpected_token_label {
1283- diag. span_label (
1284- unexpected_token_label,
1285- DiagnosticMessage :: Str ( Cow :: from ( "unexpected token" ) ) ,
1286- ) ;
1280+ diag. span_label ( unexpected_token_label, "unexpected token" ) ;
12871281 }
12881282
12891283 self . sugg . add_to_diagnostic ( & mut diag) ;
@@ -1652,15 +1646,15 @@ impl AddToDiagnostic for FnTraitMissingParen {
16521646 rustc_errors:: SubdiagnosticMessage ,
16531647 ) -> rustc_errors:: SubdiagnosticMessage ,
16541648 {
1655- diag. span_label ( self . span , crate :: fluent_generated :: parse_fn_trait_missing_paren ) ;
1649+ diag. span_label ( self . span , "`Fn` bounds require arguments in parentheses" ) ;
16561650 let applicability = if self . machine_applicable {
16571651 Applicability :: MachineApplicable
16581652 } else {
16591653 Applicability :: MaybeIncorrect
16601654 } ;
16611655 diag. span_suggestion_short (
16621656 self . span . shrink_to_hi ( ) ,
1663- crate :: fluent_generated :: parse_add_paren ,
1657+ "try adding parentheses" ,
16641658 "()" ,
16651659 applicability,
16661660 ) ;
0 commit comments