@@ -2,7 +2,7 @@ use std::borrow::Cow;
22
33use rustc_ast:: token:: Token ;
44use rustc_ast:: { Path , Visibility } ;
5- use rustc_errors:: { AddToDiagnostic , Applicability , ErrorGuaranteed , IntoDiagnostic } ;
5+ use rustc_errors:: { AddToDiagnostic , Applicability , ErrorGuaranteed , IntoDiagnostic , MultiSpan } ;
66use rustc_macros:: { Diagnostic , Subdiagnostic } ;
77use rustc_session:: errors:: ExprParenthesesNeeded ;
88use rustc_span:: edition:: { Edition , LATEST_STABLE_EDITION } ;
@@ -2372,6 +2372,43 @@ pub(crate) struct ExpectedCommaAfterPatternField {
23722372 pub span : Span ,
23732373}
23742374
2375+ #[ derive( Diagnostic ) ]
2376+ #[ diag( parse_unexpected_methodcall_in_pat) ]
2377+ pub ( crate ) struct MethodCallInPattern {
2378+ #[ primary_span]
2379+ #[ label]
2380+ pub span : Span ,
2381+ }
2382+
2383+ #[ derive( Diagnostic ) ]
2384+ #[ diag( parse_unexpected_expr_in_pat) ]
2385+ pub ( crate ) struct ExpressionInPattern {
2386+ #[ primary_span]
2387+ #[ label]
2388+ pub span : Span ,
2389+ }
2390+
2391+ #[ derive( Diagnostic ) ]
2392+ #[ diag( parse_unexpected_paren_in_range_pat) ]
2393+ pub ( crate ) struct ParenInRangePat {
2394+ #[ primary_span]
2395+ pub span : MultiSpan ,
2396+ #[ subdiagnostic]
2397+ pub sugg : ParenInRangePatSugg ,
2398+ }
2399+
2400+ #[ derive( Subdiagnostic ) ]
2401+ #[ multipart_suggestion(
2402+ parse_unexpected_paren_in_range_pat_sugg,
2403+ applicability = "machine-applicable"
2404+ ) ]
2405+ pub ( crate ) struct ParenInRangePatSugg {
2406+ #[ suggestion_part( code = "" ) ]
2407+ pub start_span : Span ,
2408+ #[ suggestion_part( code = "" ) ]
2409+ pub end_span : Span ,
2410+ }
2411+
23752412#[ derive( Diagnostic ) ]
23762413#[ diag( parse_return_types_use_thin_arrow) ]
23772414pub ( crate ) struct ReturnTypesUseThinArrow {
0 commit comments