@@ -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 ) ]
@@ -498,7 +497,7 @@ pub(crate) struct ExpectedExpressionFoundLet {
498497
499498#[ derive( Subdiagnostic , Clone , Copy ) ]
500499#[ multipart_suggestion(
501- parse_maybe_missing_let ,
500+ label = "you might have meant to continue the let-chain" ,
502501 applicability = "maybe-incorrect" ,
503502 style = "verbose"
504503) ]
@@ -509,7 +508,7 @@ pub(crate) struct MaybeMissingLet {
509508
510509#[ derive( Subdiagnostic , Clone , Copy ) ]
511510#[ multipart_suggestion(
512- parse_maybe_comparison ,
511+ label = "you might have meant to compare for equality" ,
513512 applicability = "maybe-incorrect" ,
514513 style = "verbose"
515514) ]
@@ -1247,16 +1246,18 @@ impl<'a> IntoDiagnostic<'a> for ExpectedIdentifier {
12471246
12481247 let mut diag = handler. struct_diagnostic ( match token_descr {
12491248 Some ( TokenDescription :: ReservedIdentifier ) => {
1250- fluent :: parse_expected_identifier_found_reserved_identifier_str
1249+ "expected identifier, found reserved identifier `{$token}`"
12511250 }
1252- Some ( TokenDescription :: Keyword ) => fluent :: parse_expected_identifier_found_keyword_str ,
1251+ Some ( TokenDescription :: Keyword ) => "expected identifier, found keyword `{$token}`" ,
12531252 Some ( TokenDescription :: ReservedKeyword ) => {
1254- fluent :: parse_expected_identifier_found_reserved_keyword_str
1253+ "expected identifier, found reserved keyword `{$token}`"
12551254 }
1255+
12561256 Some ( TokenDescription :: DocComment ) => {
1257- fluent :: parse_expected_identifier_found_doc_comment_str
1257+ "expected identifier, found doc comment `{$token}`"
12581258 }
1259- None => fluent:: parse_expected_identifier_found_str,
1259+
1260+ None => "expected identifier, found `{$token}`" ,
12601261 } ) ;
12611262 diag. set_span ( self . span ) ;
12621263 diag. set_arg ( "token" , self . token ) ;
@@ -1303,28 +1304,21 @@ impl<'a> IntoDiagnostic<'a> for ExpectedSemi {
13031304 let token_descr = TokenDescription :: from_token ( & self . token ) ;
13041305
13051306 let mut diag = handler. struct_diagnostic ( match token_descr {
1306- Some ( TokenDescription :: ReservedIdentifier ) => DiagnosticMessage :: Str ( Cow :: from (
1307- "expected `;`, found reserved identifier `{$token}`" ,
1308- ) ) ,
1309- Some ( TokenDescription :: Keyword ) => {
1310- DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found keyword `{$token}`" ) )
1307+ Some ( TokenDescription :: ReservedIdentifier ) => {
1308+ "expected `;`, found reserved identifier `{$token}`"
13111309 }
1310+ Some ( TokenDescription :: Keyword ) => "expected `;`, found keyword `{$token}`" ,
13121311 Some ( TokenDescription :: ReservedKeyword ) => {
1313- DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found reserved keyword `{$token}`" ) )
1314- }
1315- Some ( TokenDescription :: DocComment ) => {
1316- DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found doc comment `{$token}`" ) )
1312+ "expected `;`, found reserved keyword `{$token}`"
13171313 }
1318- None => DiagnosticMessage :: Str ( Cow :: from ( "expected `;`, found `{$token}`" ) ) ,
1314+ Some ( TokenDescription :: DocComment ) => "expected `;`, found doc comment `{$token}`" ,
1315+ None => "expected `;`, found `{$token}`" ,
13191316 } ) ;
13201317 diag. set_span ( self . span ) ;
13211318 diag. set_arg ( "token" , self . token ) ;
13221319
13231320 if let Some ( unexpected_token_label) = self . unexpected_token_label {
1324- diag. span_label (
1325- unexpected_token_label,
1326- DiagnosticMessage :: Str ( Cow :: from ( "unexpected token" ) ) ,
1327- ) ;
1321+ diag. span_label ( unexpected_token_label, "unexpected token" ) ;
13281322 }
13291323
13301324 self . sugg . add_to_diagnostic ( & mut diag) ;
@@ -1518,7 +1512,7 @@ pub(crate) struct ParenthesesInForHeadSugg {
15181512}
15191513
15201514#[ derive( Diagnostic ) ]
1521- #[ diag( parse_unexpected_parentheses_in_match_arm_pattern ) ]
1515+ #[ diag( "unexpected parentheses surrounding `match` arm pattern" ) ]
15221516pub ( crate ) struct ParenthesesInMatchPat {
15231517 #[ primary_span]
15241518 pub span : Vec < Span > ,
@@ -1527,7 +1521,7 @@ pub(crate) struct ParenthesesInMatchPat {
15271521}
15281522
15291523#[ derive( Subdiagnostic ) ]
1530- #[ multipart_suggestion( parse_suggestion , applicability = "machine-applicable" ) ]
1524+ #[ multipart_suggestion( label = "remove parentheses surrounding the pattern" , applicability = "machine-applicable" ) ]
15311525pub ( crate ) struct ParenthesesInMatchPatSugg {
15321526 #[ suggestion_part( code = "" ) ]
15331527 pub left : Span ,
@@ -1709,15 +1703,15 @@ impl AddToDiagnostic for FnTraitMissingParen {
17091703 rustc_errors:: SubdiagnosticMessage ,
17101704 ) -> rustc_errors:: SubdiagnosticMessage ,
17111705 {
1712- diag. span_label ( self . span , crate :: fluent_generated :: parse_fn_trait_missing_paren ) ;
1706+ diag. span_label ( self . span , "`Fn` bounds require arguments in parentheses" ) ;
17131707 let applicability = if self . machine_applicable {
17141708 Applicability :: MachineApplicable
17151709 } else {
17161710 Applicability :: MaybeIncorrect
17171711 } ;
17181712 diag. span_suggestion_short (
17191713 self . span . shrink_to_hi ( ) ,
1720- crate :: fluent_generated :: parse_add_paren ,
1714+ "try adding parentheses" ,
17211715 "()" ,
17221716 applicability,
17231717 ) ;
@@ -3467,7 +3461,7 @@ pub(crate) struct GenericArgsInPatRequireTurbofishSyntax {
34673461}
34683462
34693463#[ derive( Diagnostic ) ]
3470- #[ diag( parse_transpose_dyn_or_impl ) ]
3464+ #[ diag( "`for<...>` expected after `{$kw}`, not before" ) ]
34713465pub ( crate ) struct TransposeDynOrImpl < ' a > {
34723466 #[ primary_span]
34733467 pub span : Span ,
@@ -3477,7 +3471,7 @@ pub(crate) struct TransposeDynOrImpl<'a> {
34773471}
34783472
34793473#[ derive( Subdiagnostic ) ]
3480- #[ multipart_suggestion( parse_suggestion , applicability = "machine-applicable" ) ]
3474+ #[ multipart_suggestion( label = "move `{$kw}` before the `for<...>`" , applicability = "machine-applicable" ) ]
34813475pub ( crate ) struct TransposeDynOrImplSugg < ' a > {
34823476 #[ suggestion_part( code = "" ) ]
34833477 pub removal_span : Span ,
0 commit comments