@@ -320,10 +320,10 @@ pub(crate) struct FieldExpressionWithGeneric(#[primary_span] pub Span);
320
320
pub ( crate ) struct MacroInvocationWithQualifiedPath ( #[ primary_span] pub Span ) ;
321
321
322
322
#[ derive( Diagnostic ) ]
323
- #[ diag( "expected `while`, `for`, `loop` or `{` after a label" ) ]
323
+ #[ diag( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
324
324
pub ( crate ) struct UnexpectedTokenAfterLabel {
325
325
#[ primary_span]
326
- #[ label( "expected `while`, `for`, `loop` or `{` after a label" ) ]
326
+ #[ label( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
327
327
pub span : Span ,
328
328
#[ suggestion( label = "consider removing the label" , style = "verbose" , code = "" ) ]
329
329
pub remove_label : Option < Span > ,
@@ -535,7 +535,7 @@ pub(crate) struct ExpectedEqForLetExpr {
535
535
}
536
536
537
537
#[ derive( Diagnostic ) ]
538
- #[ diag( label = r#"expected `{"{"}`, found {$first_tok}"# ) ]
538
+ #[ diag( r#"expected `{"{"}`, found {$first_tok}"# ) ]
539
539
pub ( crate ) struct ExpectedElseBlock {
540
540
#[ primary_span]
541
541
pub first_tok_span : Span ,
@@ -551,10 +551,10 @@ pub(crate) struct ExpectedElseBlock {
551
551
}
552
552
553
553
#[ derive( Diagnostic ) ]
554
- #[ diag( label = r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
554
+ #[ diag( r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
555
555
pub ( crate ) struct ExpectedStructField {
556
556
#[ primary_span]
557
- #[ label( "expected one of `,`, `:`, or `}`" ) ]
557
+ #[ label( r# "expected one of `,`, `:`, or `{"}"}`"# ) ]
558
558
pub span : Span ,
559
559
pub token : Token ,
560
560
#[ label( "while parsing this struct field" ) ]
@@ -654,7 +654,7 @@ pub(crate) struct CatchAfterTry {
654
654
655
655
#[ derive( Diagnostic ) ]
656
656
#[ 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"# ) ]
658
658
pub ( crate ) struct GenFn {
659
659
#[ primary_span]
660
660
pub span : Span ,
@@ -750,11 +750,11 @@ pub(crate) struct UseEqInstead {
750
750
}
751
751
752
752
#[ derive( Diagnostic ) ]
753
- #[ diag( "expected `{}`, found `;`" ) ]
753
+ #[ diag( r# "expected { " `{}`" } , found `;`"# ) ]
754
754
pub ( crate ) struct UseEmptyBlockNotSemi {
755
755
#[ primary_span]
756
756
#[ suggestion(
757
- label = "try using `{}` instead" ,
757
+ label = r# "try using { " `{}`" } instead"# ,
758
758
style = "hidden" ,
759
759
applicability = "machine-applicable" ,
760
760
code = "{{}}"
@@ -1089,7 +1089,7 @@ pub(crate) struct IncorrectVisibilityRestriction {
1089
1089
}
1090
1090
1091
1091
#[ derive( Diagnostic ) ]
1092
- #[ diag( "<assignment> ... else { ... } is not allowed" ) ]
1092
+ #[ diag( r# "<assignment> ... else {"{"} ... {"}"} is not allowed"# ) ]
1093
1093
pub ( crate ) struct AssignmentElseNotAllowed {
1094
1094
#[ primary_span]
1095
1095
pub span : Span ,
@@ -1131,7 +1131,7 @@ pub(crate) struct InvalidExpressionInLetElse {
1131
1131
}
1132
1132
1133
1133
#[ 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"# ) ]
1135
1135
pub ( crate ) struct InvalidCurlyInLetElse {
1136
1136
#[ primary_span]
1137
1137
pub span : Span ,
@@ -1854,7 +1854,7 @@ pub struct UnexpectedTokenAfterDot<'a> {
1854
1854
1855
1855
#[ derive( Diagnostic ) ]
1856
1856
#[ 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() {"{}"}`"# ) ]
1858
1858
pub ( crate ) struct VisibilityNotFollowedByItem {
1859
1859
#[ primary_span]
1860
1860
#[ label( "the visibility" ) ]
@@ -2100,45 +2100,39 @@ pub(crate) struct EnumStructMutuallyExclusive {
2100
2100
2101
2101
#[ derive( Diagnostic ) ]
2102
2102
pub ( 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}`"# ) ]
2106
2104
ReservedIdentifier {
2107
2105
#[ primary_span]
2108
2106
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2109
2107
span : Span ,
2110
2108
token : Token ,
2111
2109
} ,
2112
2110
#[ diag(
2113
- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2111
+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2114
2112
) ]
2115
2113
Keyword {
2116
2114
#[ primary_span]
2117
2115
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2118
2116
span : Span ,
2119
2117
token : Token ,
2120
2118
} ,
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}`"# ) ]
2124
2120
ReservedKeyword {
2125
2121
#[ primary_span]
2126
2122
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2127
2123
span : Span ,
2128
2124
token : Token ,
2129
2125
} ,
2130
2126
#[ 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}`"#
2132
2128
) ]
2133
2129
DocComment {
2134
2130
#[ primary_span]
2135
2131
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2136
2132
span : Span ,
2137
2133
token : Token ,
2138
2134
} ,
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}`"# ) ]
2142
2136
Other {
2143
2137
#[ primary_span]
2144
2138
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
@@ -2481,7 +2475,7 @@ pub enum UnescapeError {
2481
2475
#[ diag( "unterminated unicode escape" ) ]
2482
2476
UnclosedUnicodeEscape (
2483
2477
#[ primary_span]
2484
- #[ label( "missing a closing `}`" ) ]
2478
+ #[ label( r# "missing a closing `{"}"}`"# ) ]
2485
2479
Span ,
2486
2480
#[ suggestion(
2487
2481
label = "terminate the unicode escape" ,
@@ -2624,7 +2618,7 @@ pub enum NoBraceUnicodeSub {
2624
2618
span : Span ,
2625
2619
suggestion : String ,
2626
2620
} ,
2627
- #[ help( r#"format of unicode escape sequences is `\u{...}`"# ) ]
2621
+ #[ help( r#"format of unicode escape sequences is `\u{"{ ...}" }`"# ) ]
2628
2622
Help ,
2629
2623
}
2630
2624
@@ -2946,7 +2940,7 @@ pub(crate) struct InvalidDynKeyword {
2946
2940
2947
2941
#[ derive( Subdiagnostic ) ]
2948
2942
pub enum HelpUseLatestEdition {
2949
- #[ help( "set `edition = \ " {$edition}\ " ` in `Cargo.toml`" ) ]
2943
+ #[ help( r# "set `edition = "{$edition}"` in `Cargo.toml`"# ) ]
2950
2944
#[ note( "for more on editions, read https://doc.rust-lang.org/edition-guide" ) ]
2951
2945
Cargo { edition : Edition } ,
2952
2946
#[ help( "pass `--edition {$edition}` to `rustc`" ) ]
@@ -3239,7 +3233,7 @@ pub(crate) struct FunctionBodyEqualsExpr {
3239
3233
3240
3234
#[ derive( Subdiagnostic ) ]
3241
3235
#[ multipart_suggestion(
3242
- label = "surround the expression with `{` and `} ` instead of `=` and `;`" ,
3236
+ label = r# "surround the expression with `{"{"} ` and `{"}"} ` instead of `=` and `;`"# ,
3243
3237
applicability = "machine-applicable"
3244
3238
) ]
3245
3239
pub ( crate ) struct FunctionBodyEqualsExprSugg {
0 commit comments