@@ -309,10 +309,10 @@ pub(crate) struct FieldExpressionWithGeneric(#[primary_span] pub Span);
309
309
pub ( crate ) struct MacroInvocationWithQualifiedPath ( #[ primary_span] pub Span ) ;
310
310
311
311
#[ derive( Diagnostic ) ]
312
- #[ diag( "expected `while`, `for`, `loop` or `{` after a label" ) ]
312
+ #[ diag( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
313
313
pub ( crate ) struct UnexpectedTokenAfterLabel {
314
314
#[ primary_span]
315
- #[ label( "expected `while`, `for`, `loop` or `{` after a label" ) ]
315
+ #[ label( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
316
316
pub span : Span ,
317
317
#[ suggestion( label = "consider removing the label" , style = "verbose" , code = "" ) ]
318
318
pub remove_label : Option < Span > ,
@@ -498,7 +498,7 @@ pub(crate) struct ExpectedEqForLetExpr {
498
498
}
499
499
500
500
#[ derive( Diagnostic ) ]
501
- #[ diag( label = r#"expected `{"{"}`, found {$first_tok}"# ) ]
501
+ #[ diag( r#"expected `{"{"}`, found {$first_tok}"# ) ]
502
502
pub ( crate ) struct ExpectedElseBlock {
503
503
#[ primary_span]
504
504
pub first_tok_span : Span ,
@@ -514,10 +514,10 @@ pub(crate) struct ExpectedElseBlock {
514
514
}
515
515
516
516
#[ derive( Diagnostic ) ]
517
- #[ diag( label = r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
517
+ #[ diag( r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
518
518
pub ( crate ) struct ExpectedStructField {
519
519
#[ primary_span]
520
- #[ label( "expected one of `,`, `:`, or `}`" ) ]
520
+ #[ label( r# "expected one of `,`, `:`, or `{"}"}`"# ) ]
521
521
pub span : Span ,
522
522
pub token : Token ,
523
523
#[ label( "while parsing this struct field" ) ]
@@ -617,7 +617,7 @@ pub(crate) struct CatchAfterTry {
617
617
618
618
#[ derive( Diagnostic ) ]
619
619
#[ diag( "`gen` functions are not yet implemented" ) ]
620
- #[ help( "for now you can use `gen {} ` blocks and return `impl Iterator` instead" ) ]
620
+ #[ help( r# "for now you can use `gen {"{}"} ` blocks and return `impl Iterator` instead"# ) ]
621
621
pub ( crate ) struct GenFn {
622
622
#[ primary_span]
623
623
pub span : Span ,
@@ -706,11 +706,11 @@ pub(crate) struct UseEqInstead {
706
706
}
707
707
708
708
#[ derive( Diagnostic ) ]
709
- #[ diag( "expected `{}`, found `;`" ) ]
709
+ #[ diag( r# "expected { " `{}`" } , found `;`"# ) ]
710
710
pub ( crate ) struct UseEmptyBlockNotSemi {
711
711
#[ primary_span]
712
712
#[ suggestion(
713
- label = "try using `{}` instead" ,
713
+ label = r# "try using { " `{}`" } instead"# ,
714
714
style = "hidden" ,
715
715
applicability = "machine-applicable" ,
716
716
code = "{{}}"
@@ -1045,7 +1045,7 @@ pub(crate) struct IncorrectVisibilityRestriction {
1045
1045
}
1046
1046
1047
1047
#[ derive( Diagnostic ) ]
1048
- #[ diag( "<assignment> ... else { ... } is not allowed" ) ]
1048
+ #[ diag( r# "<assignment> ... else {"{"} ... {"}"} is not allowed"# ) ]
1049
1049
pub ( crate ) struct AssignmentElseNotAllowed {
1050
1050
#[ primary_span]
1051
1051
pub span : Span ,
@@ -1087,7 +1087,7 @@ pub(crate) struct InvalidExpressionInLetElse {
1087
1087
}
1088
1088
1089
1089
#[ derive( Diagnostic ) ]
1090
- #[ diag( "right curly brace `} ` before `else` in a `let...else` statement not allowed" ) ]
1090
+ #[ diag( r# "right curly brace `{"}"} ` before `else` in a `let...else` statement not allowed"# ) ]
1091
1091
pub ( crate ) struct InvalidCurlyInLetElse {
1092
1092
#[ primary_span]
1093
1093
pub span : Span ,
@@ -1803,7 +1803,7 @@ pub struct UnexpectedTokenAfterDot<'a> {
1803
1803
1804
1804
#[ derive( Diagnostic ) ]
1805
1805
#[ diag( "visibility `{$vis}` is not followed by an item" ) ]
1806
- #[ help( "you likely meant to define an item, e.g., `{$vis} fn foo() {\ " {}\ " }`" ) ]
1806
+ #[ help( r# "you likely meant to define an item, e.g., `{$vis} fn foo() {"{}"}`"# ) ]
1807
1807
pub ( crate ) struct VisibilityNotFollowedByItem {
1808
1808
#[ primary_span]
1809
1809
#[ label( "the visibility" ) ]
@@ -2049,45 +2049,39 @@ pub(crate) struct EnumStructMutuallyExclusive {
2049
2049
2050
2050
#[ derive( Diagnostic ) ]
2051
2051
pub ( crate ) enum UnexpectedTokenAfterStructName {
2052
- #[ diag(
2053
- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved identifier `{$token}`"#
2054
- ) ]
2052
+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved identifier `{$token}`"# ) ]
2055
2053
ReservedIdentifier {
2056
2054
#[ primary_span]
2057
2055
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2058
2056
span : Span ,
2059
2057
token : Token ,
2060
2058
} ,
2061
2059
#[ diag(
2062
- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2060
+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2063
2061
) ]
2064
2062
Keyword {
2065
2063
#[ primary_span]
2066
2064
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2067
2065
span : Span ,
2068
2066
token : Token ,
2069
2067
} ,
2070
- #[ diag(
2071
- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved keyword `{$token}`"#
2072
- ) ]
2068
+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found reserved keyword `{$token}`"# ) ]
2073
2069
ReservedKeyword {
2074
2070
#[ primary_span]
2075
2071
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2076
2072
span : Span ,
2077
2073
token : Token ,
2078
2074
} ,
2079
2075
#[ diag(
2080
- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found doc comment `{$token}`"#
2076
+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found doc comment `{$token}`"#
2081
2077
) ]
2082
2078
DocComment {
2083
2079
#[ primary_span]
2084
2080
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
2085
2081
span : Span ,
2086
2082
token : Token ,
2087
2083
} ,
2088
- #[ diag(
2089
- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found `{$token}`"#
2090
- ) ]
2084
+ #[ diag( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found `{$token}`"# ) ]
2091
2085
Other {
2092
2086
#[ primary_span]
2093
2087
#[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
@@ -2430,7 +2424,7 @@ pub enum UnescapeError {
2430
2424
#[ diag( "unterminated unicode escape" ) ]
2431
2425
UnclosedUnicodeEscape (
2432
2426
#[ primary_span]
2433
- #[ label( "missing a closing `}`" ) ]
2427
+ #[ label( r# "missing a closing `{"}"}`"# ) ]
2434
2428
Span ,
2435
2429
#[ suggestion(
2436
2430
label = "terminate the unicode escape" ,
@@ -2573,7 +2567,7 @@ pub enum NoBraceUnicodeSub {
2573
2567
span : Span ,
2574
2568
suggestion : String ,
2575
2569
} ,
2576
- #[ help( r#"format of unicode escape sequences is `\u{...}`"# ) ]
2570
+ #[ help( r#"format of unicode escape sequences is `\u{"{ ...}" }`"# ) ]
2577
2571
Help ,
2578
2572
}
2579
2573
@@ -2895,7 +2889,7 @@ pub(crate) struct InvalidDynKeyword {
2895
2889
2896
2890
#[ derive( Subdiagnostic ) ]
2897
2891
pub enum HelpUseLatestEdition {
2898
- #[ help( "set `edition = \ " {$edition}\ " ` in `Cargo.toml`" ) ]
2892
+ #[ help( r# "set `edition = "{$edition}"` in `Cargo.toml`"# ) ]
2899
2893
#[ note( "for more on editions, read https://doc.rust-lang.org/edition-guide" ) ]
2900
2894
Cargo { edition : Edition } ,
2901
2895
#[ help( "pass `--edition {$edition}` to `rustc`" ) ]
@@ -3204,7 +3198,7 @@ pub(crate) struct FunctionBodyEqualsExpr {
3204
3198
3205
3199
#[ derive( Subdiagnostic ) ]
3206
3200
#[ multipart_suggestion(
3207
- label = "surround the expression with `{` and `} ` instead of `=` and `;`" ,
3201
+ label = r# "surround the expression with `{"{"} ` and `{"}"} ` instead of `=` and `;`"# ,
3208
3202
applicability = "machine-applicable"
3209
3203
) ]
3210
3204
pub ( crate ) struct FunctionBodyEqualsExprSugg {
0 commit comments