@@ -111,7 +111,7 @@ use rustc_session::lint::builtin::META_VARIABLE_MISUSE;
111
111
use rustc_session:: parse:: ParseSess ;
112
112
use rustc_span:: symbol:: kw;
113
113
use rustc_span:: { symbol:: Ident , MultiSpan , Span } ;
114
- use syntax:: ast:: NodeId ;
114
+ use syntax:: ast:: { Name , NodeId } ;
115
115
use syntax:: token:: { DelimToken , Token , TokenKind } ;
116
116
117
117
use smallvec:: SmallVec ;
@@ -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 < Name , 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 > {
@@ -246,14 +246,14 @@ fn check_binders(
246
246
sess. span_diagnostic . span_bug ( span, "unexpected MetaVar in lhs" ) ;
247
247
}
248
248
// There are 3 possibilities:
249
- if let Some ( prev_info) = binders. get ( & name) {
249
+ if let Some ( prev_info) = binders. get ( & name. name ) {
250
250
// 1. The meta-variable is already bound in the current LHS: This is an error.
251
251
let mut span = MultiSpan :: from_span ( span) ;
252
252
span. push_span_label ( prev_info. span , "previous declaration" . into ( ) ) ;
253
253
buffer_lint ( sess, span, node_id, "duplicate matcher binding" ) ;
254
254
} else if get_binder_info ( macros, binders, name) . is_none ( ) {
255
255
// 2. The meta-variable is free: This is a binder.
256
- binders. insert ( name, BinderInfo { span, ops : ops. into ( ) } ) ;
256
+ binders. insert ( name. name , BinderInfo { span, ops : ops. into ( ) } ) ;
257
257
} else {
258
258
// 3. The meta-variable is bound: This is an occurrence.
259
259
check_occurrences ( sess, node_id, lhs, macros, binders, ops, valid) ;
@@ -274,7 +274,7 @@ fn check_binders(
274
274
. emit ( ) ;
275
275
* valid = false ;
276
276
} else {
277
- binders. insert ( name, BinderInfo { span, ops : ops. into ( ) } ) ;
277
+ binders. insert ( name. name , BinderInfo { span, ops : ops. into ( ) } ) ;
278
278
}
279
279
}
280
280
TokenTree :: Delimited ( _, ref del) => {
@@ -302,7 +302,7 @@ fn get_binder_info<'a>(
302
302
binders : & ' a Binders ,
303
303
name : Ident ,
304
304
) -> Option < & ' a BinderInfo > {
305
- binders. get ( & name) . or_else ( || macros. find_map ( |state| state. binders . get ( & name) ) )
305
+ binders. get ( & name. name ) . or_else ( || macros. find_map ( |state| state. binders . get ( & name . name ) ) )
306
306
}
307
307
308
308
/// Checks `rhs` as part of the RHS of a macro definition and sets `valid` to false in case of
@@ -560,7 +560,7 @@ fn check_ops_is_prefix(
560
560
let mut acc: SmallVec < [ & SmallVec < [ KleeneToken ; 1 ] > ; 1 ] > = SmallVec :: new ( ) ;
561
561
for state in & macros {
562
562
acc. push ( & state. ops ) ;
563
- if let Some ( binder) = state. binders . get ( & name) {
563
+ if let Some ( binder) = state. binders . get ( & name. name ) {
564
564
// This variable concatenates the stack of operators from the RHS of the LHS where the
565
565
// meta-variable was defined to where it is used (in possibly nested macros). The
566
566
// outermost operator is first.
0 commit comments