@@ -112,7 +112,7 @@ use rustc_data_structures::fx::FxHashMap;
112
112
use rustc_session:: lint:: builtin:: META_VARIABLE_MISUSE ;
113
113
use rustc_session:: parse:: ParseSess ;
114
114
use rustc_span:: symbol:: kw;
115
- use rustc_span:: { symbol:: Ident , MultiSpan , Span } ;
115
+ use rustc_span:: { symbol:: LegacyIdent , MultiSpan , Span } ;
116
116
117
117
use smallvec:: SmallVec ;
118
118
@@ -179,7 +179,7 @@ struct BinderInfo {
179
179
}
180
180
181
181
/// An environment of meta-variables to their binder information.
182
- type Binders = FxHashMap < Ident , BinderInfo > ;
182
+ type Binders = FxHashMap < LegacyIdent , BinderInfo > ;
183
183
184
184
/// The state at which we entered a macro definition in the RHS of another macro definition.
185
185
struct MacroState < ' a > {
@@ -245,6 +245,7 @@ fn check_binders(
245
245
if macros. is_empty ( ) {
246
246
sess. span_diagnostic . span_bug ( span, "unexpected MetaVar in lhs" ) ;
247
247
}
248
+ let name = LegacyIdent :: new ( name) ;
248
249
// There are 3 possibilities:
249
250
if let Some ( prev_info) = binders. get ( & name) {
250
251
// 1. The meta-variable is already bound in the current LHS: This is an error.
@@ -264,6 +265,7 @@ fn check_binders(
264
265
if !macros. is_empty ( ) {
265
266
sess. span_diagnostic . span_bug ( span, "unexpected MetaVarDecl in nested lhs" ) ;
266
267
}
268
+ let name = LegacyIdent :: new ( name) ;
267
269
if let Some ( prev_info) = get_binder_info ( macros, binders, name) {
268
270
// Duplicate binders at the top-level macro definition are errors. The lint is only
269
271
// for nested macro definitions.
@@ -300,7 +302,7 @@ fn check_binders(
300
302
fn get_binder_info < ' a > (
301
303
mut macros : & ' a Stack < ' a , MacroState < ' a > > ,
302
304
binders : & ' a Binders ,
303
- name : Ident ,
305
+ name : LegacyIdent ,
304
306
) -> Option < & ' a BinderInfo > {
305
307
binders. get ( & name) . or_else ( || macros. find_map ( |state| state. binders . get ( & name) ) )
306
308
}
@@ -331,6 +333,7 @@ fn check_occurrences(
331
333
sess. span_diagnostic . span_bug ( span, "unexpected MetaVarDecl in rhs" )
332
334
}
333
335
TokenTree :: MetaVar ( span, name) => {
336
+ let name = LegacyIdent :: new ( name) ;
334
337
check_ops_is_prefix ( sess, node_id, macros, binders, ops, span, name) ;
335
338
}
336
339
TokenTree :: Delimited ( _, ref del) => {
@@ -552,7 +555,7 @@ fn check_ops_is_prefix(
552
555
binders : & Binders ,
553
556
ops : & Stack < ' _ , KleeneToken > ,
554
557
span : Span ,
555
- name : Ident ,
558
+ name : LegacyIdent ,
556
559
) {
557
560
let macros = macros. push ( MacroState { binders, ops : ops. into ( ) } ) ;
558
561
// Accumulates the stacks the operators of each state until (and including when) the
@@ -598,7 +601,7 @@ fn ops_is_prefix(
598
601
sess : & ParseSess ,
599
602
node_id : NodeId ,
600
603
span : Span ,
601
- name : Ident ,
604
+ name : LegacyIdent ,
602
605
binder_ops : & [ KleeneToken ] ,
603
606
occurrence_ops : & [ KleeneToken ] ,
604
607
) {
0 commit comments