@@ -317,10 +317,10 @@ pub(crate) struct FieldExpressionWithGeneric(#[primary_span] pub Span);
317317pub ( crate ) struct MacroInvocationWithQualifiedPath ( #[ primary_span] pub Span ) ;
318318
319319#[ derive( Diagnostic ) ]
320- #[ diag( "expected `while`, `for`, `loop` or `{` after a label" ) ]
320+ #[ diag( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
321321pub ( crate ) struct UnexpectedTokenAfterLabel {
322322 #[ primary_span]
323- #[ label( "expected `while`, `for`, `loop` or `{` after a label" ) ]
323+ #[ label( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
324324 pub span : Span ,
325325 #[ suggestion( label = "consider removing the label" , style = "verbose" , code = "" ) ]
326326 pub remove_label : Option < Span > ,
@@ -532,7 +532,7 @@ pub(crate) struct ExpectedEqForLetExpr {
532532}
533533
534534#[ derive( Diagnostic ) ]
535- #[ diag( label = r#"expected `{"{"}`, found {$first_tok}"# ) ]
535+ #[ diag( r#"expected `{"{"}`, found {$first_tok}"# ) ]
536536pub ( crate ) struct ExpectedElseBlock {
537537 #[ primary_span]
538538 pub first_tok_span : Span ,
@@ -548,10 +548,10 @@ pub(crate) struct ExpectedElseBlock {
548548}
549549
550550#[ derive( Diagnostic ) ]
551- #[ diag( label = r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
551+ #[ diag( r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
552552pub ( crate ) struct ExpectedStructField {
553553 #[ primary_span]
554- #[ label( "expected one of `,`, `:`, or `}`" ) ]
554+ #[ label( r# "expected one of `,`, `:`, or `{"}"}`"# ) ]
555555 pub span : Span ,
556556 pub token : Token ,
557557 #[ label( "while parsing this struct field" ) ]
@@ -651,7 +651,7 @@ pub(crate) struct CatchAfterTry {
651651
652652#[ derive( Diagnostic ) ]
653653#[ diag( "`gen` functions are not yet implemented" ) ]
654- #[ help( "for now you can use `gen {} ` blocks and return `impl Iterator` instead" ) ]
654+ #[ help( r# "for now you can use `gen {"{}"} ` blocks and return `impl Iterator` instead"# ) ]
655655pub ( crate ) struct GenFn {
656656 #[ primary_span]
657657 pub span : Span ,
@@ -747,11 +747,11 @@ pub(crate) struct UseEqInstead {
747747}
748748
749749#[ derive( Diagnostic ) ]
750- #[ diag( "expected `{}`, found `;`" ) ]
750+ #[ diag( r# "expected { " `{}`" } , found `;`"# ) ]
751751pub ( crate ) struct UseEmptyBlockNotSemi {
752752 #[ primary_span]
753753 #[ suggestion(
754- label = "try using `{}` instead" ,
754+ label = r# "try using { " `{}`" } instead"# ,
755755 style = "hidden" ,
756756 applicability = "machine-applicable" ,
757757 code = "{{}}"
@@ -1086,7 +1086,7 @@ pub(crate) struct IncorrectVisibilityRestriction {
10861086}
10871087
10881088#[ derive( Diagnostic ) ]
1089- #[ diag( "<assignment> ... else { ... } is not allowed" ) ]
1089+ #[ diag( r# "<assignment> ... else {"{"} ... {"}"} is not allowed"# ) ]
10901090pub ( crate ) struct AssignmentElseNotAllowed {
10911091 #[ primary_span]
10921092 pub span : Span ,
@@ -1128,7 +1128,7 @@ pub(crate) struct InvalidExpressionInLetElse {
11281128}
11291129
11301130#[ derive( Diagnostic ) ]
1131- #[ diag( "right curly brace `} ` before `else` in a `let...else` statement not allowed" ) ]
1131+ #[ diag( r# "right curly brace `{"}"} ` before `else` in a `let...else` statement not allowed"# ) ]
11321132pub ( crate ) struct InvalidCurlyInLetElse {
11331133 #[ primary_span]
11341134 pub span : Span ,
@@ -1860,7 +1860,7 @@ pub struct UnexpectedTokenAfterDot<'a> {
18601860
18611861#[ derive( Diagnostic ) ]
18621862#[ diag( "visibility `{$vis}` is not followed by an item" ) ]
1863- #[ help( "you likely meant to define an item, e.g., `{$vis} fn foo() {\ " {}\ " }`" ) ]
1863+ #[ help( r# "you likely meant to define an item, e.g., `{$vis} fn foo() {"{}"}`"# ) ]
18641864pub ( crate ) struct VisibilityNotFollowedByItem {
18651865 #[ primary_span]
18661866 #[ label( "the visibility" ) ]
@@ -2106,45 +2106,39 @@ pub(crate) struct EnumStructMutuallyExclusive {
21062106
21072107#[ derive( Diagnostic ) ]
21082108pub ( crate ) enum UnexpectedTokenAfterStructName {
2109- #[ diag(
2110- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved identifier `{$token}`"#
2111- ) ]
2109+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved identifier `{$token}`"# ) ]
21122110 ReservedIdentifier {
21132111 #[ primary_span]
21142112 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21152113 span : Span ,
21162114 token : Token ,
21172115 } ,
21182116 #[ diag(
2119- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2117+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
21202118 ) ]
21212119 Keyword {
21222120 #[ primary_span]
21232121 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21242122 span : Span ,
21252123 token : Token ,
21262124 } ,
2127- #[ diag(
2128- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved keyword `{$token}`"#
2129- ) ]
2125+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved keyword `{$token}`"# ) ]
21302126 ReservedKeyword {
21312127 #[ primary_span]
21322128 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21332129 span : Span ,
21342130 token : Token ,
21352131 } ,
21362132 #[ diag(
2137- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found doc comment `{$token}`"#
2133+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found doc comment `{$token}`"#
21382134 ) ]
21392135 DocComment {
21402136 #[ primary_span]
21412137 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
21422138 span : Span ,
21432139 token : Token ,
21442140 } ,
2145- #[ diag(
2146- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found `{$token}`"#
2147- ) ]
2141+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found `{$token}`"# ) ]
21482142 Other {
21492143 #[ primary_span]
21502144 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
@@ -2487,7 +2481,7 @@ pub enum UnescapeError {
24872481 #[ diag( "unterminated unicode escape" ) ]
24882482 UnclosedUnicodeEscape (
24892483 #[ primary_span]
2490- #[ label( "missing a closing `}`" ) ]
2484+ #[ label( r# "missing a closing `{"}"}`"# ) ]
24912485 Span ,
24922486 #[ suggestion(
24932487 label = "terminate the unicode escape" ,
@@ -2630,7 +2624,7 @@ pub enum NoBraceUnicodeSub {
26302624 span : Span ,
26312625 suggestion : String ,
26322626 } ,
2633- #[ help( r#"format of unicode escape sequences is `\u{...}`"# ) ]
2627+ #[ help( r#"format of unicode escape sequences is `\u{"{ ...}" }`"# ) ]
26342628 Help ,
26352629}
26362630
@@ -2952,7 +2946,7 @@ pub(crate) struct InvalidDynKeyword {
29522946
29532947#[ derive( Subdiagnostic ) ]
29542948pub enum HelpUseLatestEdition {
2955- #[ help( "set `edition = \ " {$edition}\ " ` in `Cargo.toml`" ) ]
2949+ #[ help( r# "set `edition = "{$edition}"` in `Cargo.toml`"# ) ]
29562950 #[ note( "for more on editions, read https://doc.rust-lang.org/edition-guide" ) ]
29572951 Cargo { edition : Edition } ,
29582952 #[ help( "pass `--edition {$edition}` to `rustc`" ) ]
@@ -3261,7 +3255,7 @@ pub(crate) struct FunctionBodyEqualsExpr {
32613255
32623256#[ derive( Subdiagnostic ) ]
32633257#[ multipart_suggestion(
3264- label = "surround the expression with `{` and `} ` instead of `=` and `;`" ,
3258+ label = r# "surround the expression with `{"{"} ` and `{"}"} ` instead of `=` and `;`"# ,
32653259 applicability = "machine-applicable"
32663260) ]
32673261pub ( crate ) struct FunctionBodyEqualsExprSugg {
0 commit comments