@@ -111,7 +111,7 @@ use rustc_session::lint::builtin::META_VARIABLE_MISUSE;
111111use rustc_session:: parse:: ParseSess ;
112112use rustc_span:: symbol:: kw;
113113use rustc_span:: { symbol:: Ident , MultiSpan , Span } ;
114- use syntax:: ast:: NodeId ;
114+ use syntax:: ast:: { Name , NodeId } ;
115115use syntax:: token:: { DelimToken , Token , TokenKind } ;
116116
117117use smallvec:: SmallVec ;
@@ -179,7 +179,7 @@ struct BinderInfo {
179179}
180180
181181/// An environment of meta-variables to their binder information.
182- type Binders = FxHashMap < Ident , BinderInfo > ;
182+ type Binders = FxHashMap < Name , BinderInfo > ;
183183
184184/// The state at which we entered a macro definition in the RHS of another macro definition.
185185struct MacroState < ' a > {
@@ -246,14 +246,14 @@ fn check_binders(
246246 sess. span_diagnostic . span_bug ( span, "unexpected MetaVar in lhs" ) ;
247247 }
248248 // There are 3 possibilities:
249- if let Some ( prev_info) = binders. get ( & name) {
249+ if let Some ( prev_info) = binders. get ( & name. name ) {
250250 // 1. The meta-variable is already bound in the current LHS: This is an error.
251251 let mut span = MultiSpan :: from_span ( span) ;
252252 span. push_span_label ( prev_info. span , "previous declaration" . into ( ) ) ;
253253 buffer_lint ( sess, span, node_id, "duplicate matcher binding" ) ;
254254 } else if get_binder_info ( macros, binders, name) . is_none ( ) {
255255 // 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 ( ) } ) ;
257257 } else {
258258 // 3. The meta-variable is bound: This is an occurrence.
259259 check_occurrences ( sess, node_id, lhs, macros, binders, ops, valid) ;
@@ -274,7 +274,7 @@ fn check_binders(
274274 . emit ( ) ;
275275 * valid = false ;
276276 } else {
277- binders. insert ( name, BinderInfo { span, ops : ops. into ( ) } ) ;
277+ binders. insert ( name. name , BinderInfo { span, ops : ops. into ( ) } ) ;
278278 }
279279 }
280280 TokenTree :: Delimited ( _, ref del) => {
@@ -302,7 +302,7 @@ fn get_binder_info<'a>(
302302 binders : & ' a Binders ,
303303 name : Ident ,
304304) -> 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 ) ) )
306306}
307307
308308/// 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(
560560 let mut acc: SmallVec < [ & SmallVec < [ KleeneToken ; 1 ] > ; 1 ] > = SmallVec :: new ( ) ;
561561 for state in & macros {
562562 acc. push ( & state. ops ) ;
563- if let Some ( binder) = state. binders . get ( & name) {
563+ if let Some ( binder) = state. binders . get ( & name. name ) {
564564 // This variable concatenates the stack of operators from the RHS of the LHS where the
565565 // meta-variable was defined to where it is used (in possibly nested macros). The
566566 // outermost operator is first.
0 commit comments