@@ -53,9 +53,10 @@ pub enum Node<'hir> {
5353 NodeStmt ( & ' hir Stmt ) ,
5454 NodeTy ( & ' hir Ty ) ,
5555 NodeTraitRef ( & ' hir TraitRef ) ,
56- NodeLocal ( & ' hir Pat ) ,
56+ NodeBinding ( & ' hir Pat ) ,
5757 NodePat ( & ' hir Pat ) ,
5858 NodeBlock ( & ' hir Block ) ,
59+ NodeLocal ( & ' hir Local ) ,
5960
6061 /// NodeStructCtor represents a tuple struct.
6162 NodeStructCtor ( & ' hir VariantData ) ,
@@ -83,13 +84,14 @@ enum MapEntry<'hir> {
8384 EntryStmt ( NodeId , & ' hir Stmt ) ,
8485 EntryTy ( NodeId , & ' hir Ty ) ,
8586 EntryTraitRef ( NodeId , & ' hir TraitRef ) ,
86- EntryLocal ( NodeId , & ' hir Pat ) ,
87+ EntryBinding ( NodeId , & ' hir Pat ) ,
8788 EntryPat ( NodeId , & ' hir Pat ) ,
8889 EntryBlock ( NodeId , & ' hir Block ) ,
8990 EntryStructCtor ( NodeId , & ' hir VariantData ) ,
9091 EntryLifetime ( NodeId , & ' hir Lifetime ) ,
9192 EntryTyParam ( NodeId , & ' hir TyParam ) ,
9293 EntryVisibility ( NodeId , & ' hir Visibility ) ,
94+ EntryLocal ( NodeId , & ' hir Local ) ,
9395
9496 /// Roots for node trees.
9597 RootCrate ,
@@ -114,13 +116,14 @@ impl<'hir> MapEntry<'hir> {
114116 NodeStmt ( n) => EntryStmt ( p, n) ,
115117 NodeTy ( n) => EntryTy ( p, n) ,
116118 NodeTraitRef ( n) => EntryTraitRef ( p, n) ,
117- NodeLocal ( n) => EntryLocal ( p, n) ,
119+ NodeBinding ( n) => EntryBinding ( p, n) ,
118120 NodePat ( n) => EntryPat ( p, n) ,
119121 NodeBlock ( n) => EntryBlock ( p, n) ,
120122 NodeStructCtor ( n) => EntryStructCtor ( p, n) ,
121123 NodeLifetime ( n) => EntryLifetime ( p, n) ,
122124 NodeTyParam ( n) => EntryTyParam ( p, n) ,
123125 NodeVisibility ( n) => EntryVisibility ( p, n) ,
126+ NodeLocal ( n) => EntryLocal ( p, n) ,
124127 }
125128 }
126129
@@ -136,13 +139,14 @@ impl<'hir> MapEntry<'hir> {
136139 EntryStmt ( id, _) => id,
137140 EntryTy ( id, _) => id,
138141 EntryTraitRef ( id, _) => id,
139- EntryLocal ( id, _) => id,
142+ EntryBinding ( id, _) => id,
140143 EntryPat ( id, _) => id,
141144 EntryBlock ( id, _) => id,
142145 EntryStructCtor ( id, _) => id,
143146 EntryLifetime ( id, _) => id,
144147 EntryTyParam ( id, _) => id,
145148 EntryVisibility ( id, _) => id,
149+ EntryLocal ( id, _) => id,
146150
147151 NotPresent |
148152 RootCrate => return None ,
@@ -161,13 +165,14 @@ impl<'hir> MapEntry<'hir> {
161165 EntryStmt ( _, n) => NodeStmt ( n) ,
162166 EntryTy ( _, n) => NodeTy ( n) ,
163167 EntryTraitRef ( _, n) => NodeTraitRef ( n) ,
164- EntryLocal ( _, n) => NodeLocal ( n) ,
168+ EntryBinding ( _, n) => NodeBinding ( n) ,
165169 EntryPat ( _, n) => NodePat ( n) ,
166170 EntryBlock ( _, n) => NodeBlock ( n) ,
167171 EntryStructCtor ( _, n) => NodeStructCtor ( n) ,
168172 EntryLifetime ( _, n) => NodeLifetime ( n) ,
169173 EntryTyParam ( _, n) => NodeTyParam ( n) ,
170174 EntryVisibility ( _, n) => NodeVisibility ( n) ,
175+ EntryLocal ( _, n) => NodeLocal ( n) ,
171176 _ => return None
172177 } )
173178 }
@@ -319,13 +324,14 @@ impl<'hir> Map<'hir> {
319324 EntryStmt ( p, _) |
320325 EntryTy ( p, _) |
321326 EntryTraitRef ( p, _) |
322- EntryLocal ( p, _) |
327+ EntryBinding ( p, _) |
323328 EntryPat ( p, _) |
324329 EntryBlock ( p, _) |
325330 EntryStructCtor ( p, _) |
326331 EntryLifetime ( p, _) |
327332 EntryTyParam ( p, _) |
328- EntryVisibility ( p, _) =>
333+ EntryVisibility ( p, _) |
334+ EntryLocal ( p, _) =>
329335 id = p,
330336
331337 EntryExpr ( p, _) => {
@@ -589,7 +595,7 @@ impl<'hir> Map<'hir> {
589595 /// immediate parent is an item or a closure.
590596 pub fn is_argument ( & self , id : NodeId ) -> bool {
591597 match self . find ( id) {
592- Some ( NodeLocal ( _) ) => ( ) ,
598+ Some ( NodeBinding ( _) ) => ( ) ,
593599 _ => return false ,
594600 }
595601 match self . find ( self . get_parent_node ( id) ) {
@@ -856,7 +862,7 @@ impl<'hir> Map<'hir> {
856862 NodeField ( f) => f. name ,
857863 NodeLifetime ( lt) => lt. name ,
858864 NodeTyParam ( tp) => tp. name ,
859- NodeLocal ( & Pat { node : PatKind :: Binding ( _, _, l, _) , .. } ) => l. node ,
865+ NodeBinding ( & Pat { node : PatKind :: Binding ( _, _, l, _) , .. } ) => l. node ,
860866 NodeStructCtor ( _) => self . name ( self . get_parent ( id) ) ,
861867 _ => bug ! ( "no name for {}" , self . node_to_string( id) )
862868 }
@@ -915,14 +921,15 @@ impl<'hir> Map<'hir> {
915921 Some ( EntryStmt ( _, stmt) ) => stmt. span ,
916922 Some ( EntryTy ( _, ty) ) => ty. span ,
917923 Some ( EntryTraitRef ( _, tr) ) => tr. path . span ,
918- Some ( EntryLocal ( _, pat) ) => pat. span ,
924+ Some ( EntryBinding ( _, pat) ) => pat. span ,
919925 Some ( EntryPat ( _, pat) ) => pat. span ,
920926 Some ( EntryBlock ( _, block) ) => block. span ,
921927 Some ( EntryStructCtor ( _, _) ) => self . expect_item ( self . get_parent ( id) ) . span ,
922928 Some ( EntryLifetime ( _, lifetime) ) => lifetime. span ,
923929 Some ( EntryTyParam ( _, ty_param) ) => ty_param. span ,
924930 Some ( EntryVisibility ( _, & Visibility :: Restricted { ref path, .. } ) ) => path. span ,
925931 Some ( EntryVisibility ( _, v) ) => bug ! ( "unexpected Visibility {:?}" , v) ,
932+ Some ( EntryLocal ( _, local) ) => local. span ,
926933
927934 Some ( RootCrate ) => self . forest . krate . span ,
928935 Some ( NotPresent ) | None => {
@@ -1112,7 +1119,7 @@ impl<'a> print::State<'a> {
11121119 NodeStmt ( a) => self . print_stmt ( & a) ,
11131120 NodeTy ( a) => self . print_type ( & a) ,
11141121 NodeTraitRef ( a) => self . print_trait_ref ( & a) ,
1115- NodeLocal ( a) |
1122+ NodeBinding ( a) |
11161123 NodePat ( a) => self . print_pat ( & a) ,
11171124 NodeBlock ( a) => {
11181125 use syntax:: print:: pprust:: PrintState ;
@@ -1131,6 +1138,7 @@ impl<'a> print::State<'a> {
11311138 // hir_map to reconstruct their full structure for pretty
11321139 // printing.
11331140 NodeStructCtor ( _) => bug ! ( "cannot print isolated StructCtor" ) ,
1141+ NodeLocal ( a) => self . print_local_decl ( & a) ,
11341142 }
11351143 }
11361144}
@@ -1223,7 +1231,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
12231231 Some ( NodeTraitRef ( _) ) => {
12241232 format ! ( "trait_ref {}{}" , map. node_to_pretty_string( id) , id_str)
12251233 }
1226- Some ( NodeLocal ( _) ) => {
1234+ Some ( NodeBinding ( _) ) => {
12271235 format ! ( "local {}{}" , map. node_to_pretty_string( id) , id_str)
12281236 }
12291237 Some ( NodePat ( _) ) => {
@@ -1232,6 +1240,9 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
12321240 Some ( NodeBlock ( _) ) => {
12331241 format ! ( "block {}{}" , map. node_to_pretty_string( id) , id_str)
12341242 }
1243+ Some ( NodeLocal ( _) ) => {
1244+ format ! ( "local {}{}" , map. node_to_pretty_string( id) , id_str)
1245+ }
12351246 Some ( NodeStructCtor ( _) ) => {
12361247 format ! ( "struct_ctor {}{}" , path_str( ) , id_str)
12371248 }
0 commit comments