@@ -317,10 +317,10 @@ pub(crate) struct FieldExpressionWithGeneric(#[primary_span] pub Span);
317
317
pub ( crate ) struct MacroInvocationWithQualifiedPath ( #[ primary_span] pub Span ) ;
318
318
319
319
#[ derive( Diagnostic ) ]
320
- #[ diag( "expected `while`, `for`, `loop` or `{` after a label" ) ]
320
+ #[ diag( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
321
321
pub ( crate ) struct UnexpectedTokenAfterLabel {
322
322
#[ primary_span]
323
- #[ label( "expected `while`, `for`, `loop` or `{` after a label" ) ]
323
+ #[ label( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
324
324
pub span : Span ,
325
325
#[ suggestion( label = "consider removing the label" , style = "verbose" , code = "" ) ]
326
326
pub remove_label : Option < Span > ,
@@ -532,7 +532,7 @@ pub(crate) struct ExpectedEqForLetExpr {
532
532
}
533
533
534
534
#[ derive( Diagnostic ) ]
535
- #[ diag( label = r#"expected `{"{"}`, found {$first_tok}"# ) ]
535
+ #[ diag( r#"expected `{"{"}`, found {$first_tok}"# ) ]
536
536
pub ( crate ) struct ExpectedElseBlock {
537
537
#[ primary_span]
538
538
pub first_tok_span : Span ,
@@ -548,10 +548,10 @@ pub(crate) struct ExpectedElseBlock {
548
548
}
549
549
550
550
#[ derive( Diagnostic ) ]
551
- #[ diag( label = r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
551
+ #[ diag( r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
552
552
pub ( crate ) struct ExpectedStructField {
553
553
#[ primary_span]
554
- #[ label( "expected one of `,`, `:`, or `}`" ) ]
554
+ #[ label( r# "expected one of `,`, `:`, or `{"}"}`"# ) ]
555
555
pub span : Span ,
556
556
pub token : Token ,
557
557
#[ label( "while parsing this struct field" ) ]
@@ -651,7 +651,7 @@ pub(crate) struct CatchAfterTry {
651
651
652
652
#[ derive( Diagnostic ) ]
653
653
#[ 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"# ) ]
655
655
pub ( crate ) struct GenFn {
656
656
#[ primary_span]
657
657
pub span : Span ,
@@ -747,11 +747,11 @@ pub(crate) struct UseEqInstead {
747
747
}
748
748
749
749
#[ derive( Diagnostic ) ]
750
- #[ diag( "expected `{}`, found `;`" ) ]
750
+ #[ diag( r# "expected { " `{}`" } , found `;`"# ) ]
751
751
pub ( crate ) struct UseEmptyBlockNotSemi {
752
752
#[ primary_span]
753
753
#[ suggestion(
754
- label = "try using `{}` instead" ,
754
+ label = r# "try using { " `{}`" } instead"# ,
755
755
style = "hidden" ,
756
756
applicability = "machine-applicable" ,
757
757
code = "{{}}"
@@ -1086,7 +1086,7 @@ pub(crate) struct IncorrectVisibilityRestriction {
1086
1086
}
1087
1087
1088
1088
#[ derive( Diagnostic ) ]
1089
- #[ diag( "<assignment> ... else { ... } is not allowed" ) ]
1089
+ #[ diag( r# "<assignment> ... else {"{"} ... {"}"} is not allowed"# ) ]
1090
1090
pub ( crate ) struct AssignmentElseNotAllowed {
1091
1091
#[ primary_span]
1092
1092
pub span : Span ,
@@ -1128,7 +1128,7 @@ pub(crate) struct InvalidExpressionInLetElse {
1128
1128
}
1129
1129
1130
1130
#[ 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"# ) ]
1132
1132
pub ( crate ) struct InvalidCurlyInLetElse {
1133
1133
#[ primary_span]
1134
1134
pub span : Span ,
@@ -1860,7 +1860,7 @@ pub struct UnexpectedTokenAfterDot<'a> {
1860
1860
1861
1861
#[ derive( Diagnostic ) ]
1862
1862
#[ 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() {"{}"}`"# ) ]
1864
1864
pub ( crate ) struct VisibilityNotFollowedByItem {
1865
1865
#[ primary_span]
1866
1866
#[ label( "the visibility" ) ]
@@ -2106,45 +2106,39 @@ pub(crate) struct EnumStructMutuallyExclusive {
2106
2106
2107
2107
#[ derive( Diagnostic ) ]
2108
2108
pub ( 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}`"# ) ]
2112
2110
ReservedIdentifier {
2113
2111
#[ primary_span]
2114
2112
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2115
2113
span : Span ,
2116
2114
token : Token ,
2117
2115
} ,
2118
2116
#[ diag(
2119
- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2117
+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2120
2118
) ]
2121
2119
Keyword {
2122
2120
#[ primary_span]
2123
2121
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2124
2122
span : Span ,
2125
2123
token : Token ,
2126
2124
} ,
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}`"# ) ]
2130
2126
ReservedKeyword {
2131
2127
#[ primary_span]
2132
2128
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2133
2129
span : Span ,
2134
2130
token : Token ,
2135
2131
} ,
2136
2132
#[ 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}`"#
2138
2134
) ]
2139
2135
DocComment {
2140
2136
#[ primary_span]
2141
2137
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2142
2138
span : Span ,
2143
2139
token : Token ,
2144
2140
} ,
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}`"# ) ]
2148
2142
Other {
2149
2143
#[ primary_span]
2150
2144
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
@@ -2487,7 +2481,7 @@ pub enum UnescapeError {
2487
2481
#[ diag( "unterminated unicode escape" ) ]
2488
2482
UnclosedUnicodeEscape (
2489
2483
#[ primary_span]
2490
- #[ label( "missing a closing `}`" ) ]
2484
+ #[ label( r# "missing a closing `{"}"}`"# ) ]
2491
2485
Span ,
2492
2486
#[ suggestion(
2493
2487
label = "terminate the unicode escape" ,
@@ -2630,7 +2624,7 @@ pub enum NoBraceUnicodeSub {
2630
2624
span : Span ,
2631
2625
suggestion : String ,
2632
2626
} ,
2633
- #[ help( r#"format of unicode escape sequences is `\u{...}`"# ) ]
2627
+ #[ help( r#"format of unicode escape sequences is `\u{"{ ...}" }`"# ) ]
2634
2628
Help ,
2635
2629
}
2636
2630
@@ -2952,7 +2946,7 @@ pub(crate) struct InvalidDynKeyword {
2952
2946
2953
2947
#[ derive( Subdiagnostic ) ]
2954
2948
pub enum HelpUseLatestEdition {
2955
- #[ help( "set `edition = \ " {$edition}\ " ` in `Cargo.toml`" ) ]
2949
+ #[ help( r# "set `edition = "{$edition}"` in `Cargo.toml`"# ) ]
2956
2950
#[ note( "for more on editions, read https://doc.rust-lang.org/edition-guide" ) ]
2957
2951
Cargo { edition : Edition } ,
2958
2952
#[ help( "pass `--edition {$edition}` to `rustc`" ) ]
@@ -3261,7 +3255,7 @@ pub(crate) struct FunctionBodyEqualsExpr {
3261
3255
3262
3256
#[ derive( Subdiagnostic ) ]
3263
3257
#[ multipart_suggestion(
3264
- label = "surround the expression with `{` and `} ` instead of `=` and `;`" ,
3258
+ label = r# "surround the expression with `{"{"} ` and `{"}"} ` instead of `=` and `;`"# ,
3265
3259
applicability = "machine-applicable"
3266
3260
) ]
3267
3261
pub ( crate ) struct FunctionBodyEqualsExprSugg {
0 commit comments