@@ -2,7 +2,7 @@ use crate::errors;
2
2
use crate :: mbe:: macro_parser:: count_metavar_decls;
3
3
use crate :: mbe:: { Delimited , KleeneOp , KleeneToken , MetaVarExpr , SequenceRepetition , TokenTree } ;
4
4
5
- use rustc_ast:: token:: { self , Delimiter , IdentIsRaw , Token } ;
5
+ use rustc_ast:: token:: { self , Delimiter , IdentIsRaw , NonterminalKind , Token } ;
6
6
use rustc_ast:: { tokenstream, NodeId } ;
7
7
use rustc_ast_pretty:: pprust;
8
8
use rustc_feature:: Features ;
@@ -85,36 +85,31 @@ pub(super) fn parse(
85
85
span. edition ( )
86
86
}
87
87
} ;
88
- let kind =
89
- token:: NonterminalKind :: from_symbol ( fragment. name , edition)
90
- . unwrap_or_else ( || {
91
- let help = match fragment. name {
92
- sym:: expr_2021 => {
93
- format ! (
94
- "fragment specifier `expr_2021` \
95
- requires Rust 2021 or later\n \
96
- {VALID_FRAGMENT_NAMES_MSG}"
97
- )
98
- }
99
- _ if edition ( ) . at_least_rust_2021 ( )
100
- && features
101
- . expr_fragment_specifier_2024 =>
102
- {
103
- VALID_FRAGMENT_NAMES_MSG_2021 . into ( )
104
- }
105
- _ => VALID_FRAGMENT_NAMES_MSG . into ( ) ,
106
- } ;
107
- sess. dcx ( ) . emit_err (
108
- errors:: InvalidFragmentSpecifier {
109
- span,
110
- fragment,
111
- help,
112
- } ,
113
- ) ;
114
- token:: NonterminalKind :: Ident
88
+ let kind = NonterminalKind :: from_symbol ( fragment. name , edition)
89
+ . unwrap_or_else ( || {
90
+ let help = match fragment. name {
91
+ sym:: expr_2021 => {
92
+ format ! (
93
+ "fragment specifier `expr_2021` \
94
+ requires Rust 2021 or later\n \
95
+ {VALID_FRAGMENT_NAMES_MSG}"
96
+ )
97
+ }
98
+ _ if edition ( ) . at_least_rust_2021 ( )
99
+ && features. expr_fragment_specifier_2024 =>
100
+ {
101
+ VALID_FRAGMENT_NAMES_MSG_2021 . into ( )
102
+ }
103
+ _ => VALID_FRAGMENT_NAMES_MSG . into ( ) ,
104
+ } ;
105
+ sess. dcx ( ) . emit_err ( errors:: InvalidFragmentSpecifier {
106
+ span,
107
+ fragment,
108
+ help,
115
109
} ) ;
116
- if kind
117
- == ( token:: NonterminalKind :: Expr2021 { inferred : false } )
110
+ NonterminalKind :: Ident
111
+ } ) ;
112
+ if kind == ( NonterminalKind :: Expr2021 { inferred : false } )
118
113
&& !features. expr_fragment_specifier_2024
119
114
{
120
115
rustc_session:: parse:: feature_err (
0 commit comments