This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ expand_duplicate_matcher_binding = duplicate matcher binding
3333expand_expected_comma_in_list =
3434 expected token: `,`
3535
36+ expand_expected_paren_or_brace =
37+ expected `(` or `{ " { " } `, found `{ $token } `
38+
3639expand_explain_doc_comment_inner =
3740 inner doc comments expand to `#![doc = "..."]`, which is what this macro attempted to match
3841
Original file line number Diff line number Diff line change @@ -448,3 +448,11 @@ pub struct InvalidFragmentSpecifier {
448448 pub fragment : Ident ,
449449 pub help : String ,
450450}
451+
452+ #[ derive( Diagnostic ) ]
453+ #[ diag( expand_expected_paren_or_brace) ]
454+ pub struct ExpectedParenOrBrace < ' a > {
455+ #[ primary_span]
456+ pub span : Span ,
457+ pub token : Cow < ' a , str > ,
458+ }
Original file line number Diff line number Diff line change @@ -194,9 +194,11 @@ fn parse_tree<'a>(
194194 }
195195 Delimiter :: Parenthesis => { }
196196 _ => {
197- let tok = pprust:: token_kind_to_string ( & token:: OpenDelim ( delim) ) ;
198- let msg = format ! ( "expected `(` or `{{`, found `{tok}`" ) ;
199- sess. dcx ( ) . span_err ( delim_span. entire ( ) , msg) ;
197+ let token = pprust:: token_kind_to_string ( & token:: OpenDelim ( delim) ) ;
198+ sess. dcx ( ) . emit_err ( errors:: ExpectedParenOrBrace {
199+ span : delim_span. entire ( ) ,
200+ token,
201+ } ) ;
200202 }
201203 }
202204 }
You can’t perform that action at this time.
0 commit comments