@@ -309,10 +309,10 @@ pub(crate) struct FieldExpressionWithGeneric(#[primary_span] pub Span);
309309pub ( crate ) struct MacroInvocationWithQualifiedPath ( #[ primary_span] pub Span ) ;
310310
311311#[ derive( Diagnostic ) ]
312- #[ diag( "expected `while`, `for`, `loop` or `{` after a label" ) ]
312+ #[ diag( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
313313pub ( crate ) struct UnexpectedTokenAfterLabel {
314314 #[ primary_span]
315- #[ label( "expected `while`, `for`, `loop` or `{` after a label" ) ]
315+ #[ label( r# "expected `while`, `for`, `loop` or `{"{"} ` after a label"# ) ]
316316 pub span : Span ,
317317 #[ suggestion( label = "consider removing the label" , style = "verbose" , code = "" ) ]
318318 pub remove_label : Option < Span > ,
@@ -498,7 +498,7 @@ pub(crate) struct ExpectedEqForLetExpr {
498498}
499499
500500#[ derive( Diagnostic ) ]
501- #[ diag( label = r#"expected `{"{"}`, found {$first_tok}"# ) ]
501+ #[ diag( r#"expected `{"{"}`, found {$first_tok}"# ) ]
502502pub ( crate ) struct ExpectedElseBlock {
503503 #[ primary_span]
504504 pub first_tok_span : Span ,
@@ -514,10 +514,10 @@ pub(crate) struct ExpectedElseBlock {
514514}
515515
516516#[ derive( Diagnostic ) ]
517- #[ diag( label = r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
517+ #[ diag( r#"expected one of `,`, `:`, or `{"}"}`, found `{$token}`"# ) ]
518518pub ( crate ) struct ExpectedStructField {
519519 #[ primary_span]
520- #[ label( "expected one of `,`, `:`, or `}`" ) ]
520+ #[ label( r# "expected one of `,`, `:`, or `{"}"}`"# ) ]
521521 pub span : Span ,
522522 pub token : Token ,
523523 #[ label( "while parsing this struct field" ) ]
@@ -617,7 +617,7 @@ pub(crate) struct CatchAfterTry {
617617
618618#[ derive( Diagnostic ) ]
619619#[ 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"# ) ]
621621pub ( crate ) struct GenFn {
622622 #[ primary_span]
623623 pub span : Span ,
@@ -706,11 +706,11 @@ pub(crate) struct UseEqInstead {
706706}
707707
708708#[ derive( Diagnostic ) ]
709- #[ diag( "expected `{}`, found `;`" ) ]
709+ #[ diag( r# "expected { " `{}`" } , found `;`"# ) ]
710710pub ( crate ) struct UseEmptyBlockNotSemi {
711711 #[ primary_span]
712712 #[ suggestion(
713- label = "try using `{}` instead" ,
713+ label = r# "try using { " `{}`" } instead"# ,
714714 style = "hidden" ,
715715 applicability = "machine-applicable" ,
716716 code = "{{}}"
@@ -1045,7 +1045,7 @@ pub(crate) struct IncorrectVisibilityRestriction {
10451045}
10461046
10471047#[ derive( Diagnostic ) ]
1048- #[ diag( "<assignment> ... else { ... } is not allowed" ) ]
1048+ #[ diag( r# "<assignment> ... else {"{"} ... {"}"} is not allowed"# ) ]
10491049pub ( crate ) struct AssignmentElseNotAllowed {
10501050 #[ primary_span]
10511051 pub span : Span ,
@@ -1087,7 +1087,7 @@ pub(crate) struct InvalidExpressionInLetElse {
10871087}
10881088
10891089#[ 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"# ) ]
10911091pub ( crate ) struct InvalidCurlyInLetElse {
10921092 #[ primary_span]
10931093 pub span : Span ,
@@ -1803,7 +1803,7 @@ pub struct UnexpectedTokenAfterDot<'a> {
18031803
18041804#[ derive( Diagnostic ) ]
18051805#[ 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() {"{}"}`"# ) ]
18071807pub ( crate ) struct VisibilityNotFollowedByItem {
18081808 #[ primary_span]
18091809 #[ label( "the visibility" ) ]
@@ -2049,45 +2049,39 @@ pub(crate) struct EnumStructMutuallyExclusive {
20492049
20502050#[ derive( Diagnostic ) ]
20512051pub ( 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}`"# ) ]
20552053 ReservedIdentifier {
20562054 #[ primary_span]
20572055 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
20582056 span : Span ,
20592057 token : Token ,
20602058 } ,
20612059 #[ diag(
2062- label = r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
2060+ r#"expected `where`, `{"{"}`, `(`, or `;` after struct name, found keyword `{$token}`"#
20632061 ) ]
20642062 Keyword {
20652063 #[ primary_span]
20662064 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
20672065 span : Span ,
20682066 token : Token ,
20692067 } ,
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}`"# ) ]
20732069 ReservedKeyword {
20742070 #[ primary_span]
20752071 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
20762072 span : Span ,
20772073 token : Token ,
20782074 } ,
20792075 #[ 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}`"#
20812077 ) ]
20822078 DocComment {
20832079 #[ primary_span]
20842080 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
20852081 span : Span ,
20862082 token : Token ,
20872083 } ,
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}`"# ) ]
20912085 Other {
20922086 #[ primary_span]
20932087 #[ label( r#"expected `where`, `{"{"}`, `(`, or `;` after struct name"# ) ]
@@ -2430,7 +2424,7 @@ pub enum UnescapeError {
24302424 #[ diag( "unterminated unicode escape" ) ]
24312425 UnclosedUnicodeEscape (
24322426 #[ primary_span]
2433- #[ label( "missing a closing `}`" ) ]
2427+ #[ label( r# "missing a closing `{"}"}`"# ) ]
24342428 Span ,
24352429 #[ suggestion(
24362430 label = "terminate the unicode escape" ,
@@ -2573,7 +2567,7 @@ pub enum NoBraceUnicodeSub {
25732567 span : Span ,
25742568 suggestion : String ,
25752569 } ,
2576- #[ help( r#"format of unicode escape sequences is `\u{...}`"# ) ]
2570+ #[ help( r#"format of unicode escape sequences is `\u{"{ ...}" }`"# ) ]
25772571 Help ,
25782572}
25792573
@@ -2895,7 +2889,7 @@ pub(crate) struct InvalidDynKeyword {
28952889
28962890#[ derive( Subdiagnostic ) ]
28972891pub enum HelpUseLatestEdition {
2898- #[ help( "set `edition = \ " {$edition}\ " ` in `Cargo.toml`" ) ]
2892+ #[ help( r# "set `edition = "{$edition}"` in `Cargo.toml`"# ) ]
28992893 #[ note( "for more on editions, read https://doc.rust-lang.org/edition-guide" ) ]
29002894 Cargo { edition : Edition } ,
29012895 #[ help( "pass `--edition {$edition}` to `rustc`" ) ]
@@ -3204,7 +3198,7 @@ pub(crate) struct FunctionBodyEqualsExpr {
32043198
32053199#[ derive( Subdiagnostic ) ]
32063200#[ multipart_suggestion(
3207- label = "surround the expression with `{` and `} ` instead of `=` and `;`" ,
3201+ label = r# "surround the expression with `{"{"} ` and `{"}"} ` instead of `=` and `;`"# ,
32083202 applicability = "machine-applicable"
32093203) ]
32103204pub ( crate ) struct FunctionBodyEqualsExprSugg {
0 commit comments