File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
compiler/rustc_expand/src/mbe Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1027,6 +1027,24 @@ fn check_matcher_core(
10271027 ) ,
10281028 ) ;
10291029 err. span_label ( sp, format ! ( "not allowed after `{}` fragments" , kind) ) ;
1030+
1031+ if kind == NonterminalKind :: PatWithOr
1032+ && sess. edition == Edition :: Edition2021
1033+ && next_token. is_token ( & BinOp ( token:: BinOpToken :: Or ) )
1034+ {
1035+ let suggestion = quoted_tt_to_string ( & TokenTree :: MetaVarDecl (
1036+ span,
1037+ name,
1038+ Some ( NonterminalKind :: PatParam { inferred : false } ) ,
1039+ ) ) ;
1040+ err. span_suggestion (
1041+ span,
1042+ & format ! ( "try a `pat_param` fragment specifier instead" ) ,
1043+ suggestion,
1044+ Applicability :: MaybeIncorrect ,
1045+ ) ;
1046+ }
1047+
10301048 let msg = "allowed there are: " ;
10311049 match possible {
10321050 & [ ] => { }
You can’t perform that action at this time.
0 commit comments