@@ -320,10 +320,10 @@ pub(crate) struct FieldExpressionWithGeneric(#[primary_span] pub Span);
320320pub ( crate ) struct MacroInvocationWithQualifiedPath ( #[ primary_span] pub Span ) ;
321321
322322#[ derive( Diagnostic ) ]
323- #[ diag( "expected `while`, `for`, `loop` or `{` after a label" ) ]
323+ #[ diag( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
324324pub ( crate ) struct UnexpectedTokenAfterLabel {
325325 #[ primary_span]
326- #[ label( "expected `while`, `for`, `loop` or `{` after a label" ) ]
326+ #[ label( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
327327 pub span : Span ,
328328 #[ suggestion( label = "consider removing the label" , style = "verbose" , code = "" ) ]
329329 pub remove_label : Option < Span > ,
@@ -535,7 +535,7 @@ pub(crate) struct ExpectedEqForLetExpr {
535535}
536536
537537#[ derive( Diagnostic ) ]
538- #[ diag( label = r#"expected `{"{"}`, found {$first_tok}"# ) ]
538+ #[ diag( r#"expected `{"{"}`, found {$first_tok}"# ) ]
539539pub ( crate ) struct ExpectedElseBlock {
540540 #[ primary_span]
541541 pub first_tok_span : Span ,
@@ -551,10 +551,10 @@ pub(crate) struct ExpectedElseBlock {
551551}
552552
553553#[ derive( Diagnostic ) ]
554- #[ diag( label = r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
554+ #[ diag( r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
555555pub ( crate ) struct ExpectedStructField {
556556 #[ primary_span]
557- #[ label( "expected one of `,`, `:`, or `}`" ) ]
557+ #[ label( r# "expected one of `,`, `:`, or `{"}"}`"# ) ]
558558 pub span : Span ,
559559 pub token : Token ,
560560 #[ label( "while parsing this struct field" ) ]
@@ -654,7 +654,7 @@ pub(crate) struct CatchAfterTry {
654654
655655#[ derive( Diagnostic ) ]
656656#[ diag( "`gen` functions are not yet implemented" ) ]
657- #[ help( "for now you can use `gen {} ` blocks and return `impl Iterator` instead" ) ]
657+ #[ help( r# "for now you can use `gen {"{}"} ` blocks and return `impl Iterator` instead"# ) ]
658658pub ( crate ) struct GenFn {
659659 #[ primary_span]
660660 pub span : Span ,
@@ -750,11 +750,11 @@ pub(crate) struct UseEqInstead {
750750}
751751
752752#[ derive( Diagnostic ) ]
753- #[ diag( "expected `{}`, found `;`" ) ]
753+ #[ diag( r# "expected { " `{}`" } , found `;`"# ) ]
754754pub ( crate ) struct UseEmptyBlockNotSemi {
755755 #[ primary_span]
756756 #[ suggestion(
757- label = "try using `{}` instead" ,
757+ label = r# "try using { " `{}`" } instead"# ,
758758 style = "hidden" ,
759759 applicability = "machine-applicable" ,
760760 code = "{{}}"
@@ -1089,7 +1089,7 @@ pub(crate) struct IncorrectVisibilityRestriction {
10891089}
10901090
10911091#[ derive( Diagnostic ) ]
1092- #[ diag( "<assignment> ... else { ... } is not allowed" ) ]
1092+ #[ diag( r# "<assignment> ... else {"{"} ... {"}"} is not allowed"# ) ]
10931093pub ( crate ) struct AssignmentElseNotAllowed {
10941094 #[ primary_span]
10951095 pub span : Span ,
@@ -1131,7 +1131,7 @@ pub(crate) struct InvalidExpressionInLetElse {
11311131}
11321132
11331133#[ derive( Diagnostic ) ]
1134- #[ diag( "right curly brace `} ` before `else` in a `let...else` statement not allowed" ) ]
1134+ #[ diag( r# "right curly brace `{"}"} ` before `else` in a `let...else` statement not allowed"# ) ]
11351135pub ( crate ) struct InvalidCurlyInLetElse {
11361136 #[ primary_span]
11371137 pub span : Span ,
@@ -1854,7 +1854,7 @@ pub struct UnexpectedTokenAfterDot<'a> {
18541854
18551855#[ derive( Diagnostic ) ]
18561856#[ diag( "visibility `{$vis}` is not followed by an item" ) ]
1857- #[ help( "you likely meant to define an item, e.g., `{$vis} fn foo() {\ " {}\ " }`" ) ]
1857+ #[ help( r# "you likely meant to define an item, e.g., `{$vis} fn foo() {"{}"}`"# ) ]
18581858pub ( crate ) struct VisibilityNotFollowedByItem {
18591859 #[ primary_span]
18601860 #[ label( "the visibility" ) ]
@@ -2100,45 +2100,39 @@ pub(crate) struct EnumStructMutuallyExclusive {
21002100
21012101#[ derive( Diagnostic ) ]
21022102pub ( crate ) enum UnexpectedTokenAfterStructName {
2103- #[ diag(
2104- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved identifier `{$token}`"#
2105- ) ]
2103+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved identifier `{$token}`"# ) ]
21062104 ReservedIdentifier {
21072105 #[ primary_span]
21082106 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21092107 span : Span ,
21102108 token : Token ,
21112109 } ,
21122110 #[ diag(
2113- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2111+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
21142112 ) ]
21152113 Keyword {
21162114 #[ primary_span]
21172115 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21182116 span : Span ,
21192117 token : Token ,
21202118 } ,
2121- #[ diag(
2122- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved keyword `{$token}`"#
2123- ) ]
2119+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved keyword `{$token}`"# ) ]
21242120 ReservedKeyword {
21252121 #[ primary_span]
21262122 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21272123 span : Span ,
21282124 token : Token ,
21292125 } ,
21302126 #[ diag(
2131- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found doc comment `{$token}`"#
2127+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found doc comment `{$token}`"#
21322128 ) ]
21332129 DocComment {
21342130 #[ primary_span]
21352131 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21362132 span : Span ,
21372133 token : Token ,
21382134 } ,
2139- #[ diag(
2140- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found `{$token}`"#
2141- ) ]
2135+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found `{$token}`"# ) ]
21422136 Other {
21432137 #[ primary_span]
21442138 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
@@ -2481,7 +2475,7 @@ pub enum UnescapeError {
24812475 #[ diag( "unterminated unicode escape" ) ]
24822476 UnclosedUnicodeEscape (
24832477 #[ primary_span]
2484- #[ label( "missing a closing `}`" ) ]
2478+ #[ label( r# "missing a closing `{"}"}`"# ) ]
24852479 Span ,
24862480 #[ suggestion(
24872481 label = "terminate the unicode escape" ,
@@ -2624,7 +2618,7 @@ pub enum NoBraceUnicodeSub {
26242618 span : Span ,
26252619 suggestion : String ,
26262620 } ,
2627- #[ help( r#"format of unicode escape sequences is `\u{...}`"# ) ]
2621+ #[ help( r#"format of unicode escape sequences is `\u{"{ ...}" }`"# ) ]
26282622 Help ,
26292623}
26302624
@@ -2946,7 +2940,7 @@ pub(crate) struct InvalidDynKeyword {
29462940
29472941#[ derive( Subdiagnostic ) ]
29482942pub enum HelpUseLatestEdition {
2949- #[ help( "set `edition = \ " {$edition}\ " ` in `Cargo.toml`" ) ]
2943+ #[ help( r# "set `edition = "{$edition}"` in `Cargo.toml`"# ) ]
29502944 #[ note( "for more on editions, read https://doc.rust-lang.org/edition-guide" ) ]
29512945 Cargo { edition : Edition } ,
29522946 #[ help( "pass `--edition {$edition}` to `rustc`" ) ]
@@ -3239,7 +3233,7 @@ pub(crate) struct FunctionBodyEqualsExpr {
32393233
32403234#[ derive( Subdiagnostic ) ]
32413235#[ multipart_suggestion(
3242- label = "surround the expression with `{` and `} ` instead of `=` and `;`" ,
3236+ label = r# "surround the expression with `{"{"} ` and `{"}"} ` instead of `=` and `;`"# ,
32433237 applicability = "machine-applicable"
32443238) ]
32453239pub ( crate ) struct FunctionBodyEqualsExprSugg {
0 commit comments