2
2
// pieces of AST and HIR. The resulting numbers are good approximations but not
3
3
// completely accurate (some things might be counted twice, others missed).
4
4
5
- use rustc:: hir;
5
+ use rustc:: hir:: { self , HirId } ;
6
6
use rustc:: hir:: intravisit as hir_visit;
7
7
use rustc:: util:: common:: to_readable_str;
8
8
use rustc:: util:: nodemap:: { FxHashMap , FxHashSet } ;
@@ -12,7 +12,7 @@ use syntax_pos::Span;
12
12
13
13
#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
14
14
enum Id {
15
- Node ( NodeId ) ,
15
+ Node ( HirId ) ,
16
16
Attr ( AttrId ) ,
17
17
None ,
18
18
}
@@ -119,7 +119,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
119
119
}
120
120
121
121
fn visit_item ( & mut self , i : & ' v hir:: Item ) {
122
- self . record ( "Item" , Id :: Node ( i. id ) , i) ;
122
+ self . record ( "Item" , Id :: Node ( i. hir_id ) , i) ;
123
123
hir_visit:: walk_item ( self , i)
124
124
}
125
125
@@ -129,22 +129,22 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
129
129
}
130
130
131
131
fn visit_foreign_item ( & mut self , i : & ' v hir:: ForeignItem ) {
132
- self . record ( "ForeignItem" , Id :: Node ( i. id ) , i) ;
132
+ self . record ( "ForeignItem" , Id :: Node ( i. hir_id ) , i) ;
133
133
hir_visit:: walk_foreign_item ( self , i)
134
134
}
135
135
136
136
fn visit_local ( & mut self , l : & ' v hir:: Local ) {
137
- self . record ( "Local" , Id :: Node ( l. id ) , l) ;
137
+ self . record ( "Local" , Id :: Node ( l. hir_id ) , l) ;
138
138
hir_visit:: walk_local ( self , l)
139
139
}
140
140
141
141
fn visit_block ( & mut self , b : & ' v hir:: Block ) {
142
- self . record ( "Block" , Id :: Node ( b. id ) , b) ;
142
+ self . record ( "Block" , Id :: Node ( b. hir_id ) , b) ;
143
143
hir_visit:: walk_block ( self , b)
144
144
}
145
145
146
146
fn visit_stmt ( & mut self , s : & ' v hir:: Stmt ) {
147
- self . record ( "Stmt" , Id :: Node ( s. id ) , s) ;
147
+ self . record ( "Stmt" , Id :: Node ( s. hir_id ) , s) ;
148
148
hir_visit:: walk_stmt ( self , s)
149
149
}
150
150
@@ -154,17 +154,17 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
154
154
}
155
155
156
156
fn visit_pat ( & mut self , p : & ' v hir:: Pat ) {
157
- self . record ( "Pat" , Id :: Node ( p. id ) , p) ;
157
+ self . record ( "Pat" , Id :: Node ( p. hir_id ) , p) ;
158
158
hir_visit:: walk_pat ( self , p)
159
159
}
160
160
161
161
fn visit_expr ( & mut self , ex : & ' v hir:: Expr ) {
162
- self . record ( "Expr" , Id :: Node ( ex. id ) , ex) ;
162
+ self . record ( "Expr" , Id :: Node ( ex. hir_id ) , ex) ;
163
163
hir_visit:: walk_expr ( self , ex)
164
164
}
165
165
166
166
fn visit_ty ( & mut self , t : & ' v hir:: Ty ) {
167
- self . record ( "Ty" , Id :: Node ( t. id ) , t) ;
167
+ self . record ( "Ty" , Id :: Node ( t. hir_id ) , t) ;
168
168
hir_visit:: walk_ty ( self , t)
169
169
}
170
170
@@ -184,12 +184,12 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
184
184
}
185
185
186
186
fn visit_trait_item ( & mut self , ti : & ' v hir:: TraitItem ) {
187
- self . record ( "TraitItem" , Id :: Node ( ti. id ) , ti) ;
187
+ self . record ( "TraitItem" , Id :: Node ( ti. hir_id ) , ti) ;
188
188
hir_visit:: walk_trait_item ( self , ti)
189
189
}
190
190
191
191
fn visit_impl_item ( & mut self , ii : & ' v hir:: ImplItem ) {
192
- self . record ( "ImplItem" , Id :: Node ( ii. id ) , ii) ;
192
+ self . record ( "ImplItem" , Id :: Node ( ii. hir_id ) , ii) ;
193
193
hir_visit:: walk_impl_item ( self , ii)
194
194
}
195
195
@@ -199,7 +199,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
199
199
}
200
200
201
201
fn visit_struct_field ( & mut self , s : & ' v hir:: StructField ) {
202
- self . record ( "StructField" , Id :: Node ( s. id ) , s) ;
202
+ self . record ( "StructField" , Id :: Node ( s. hir_id ) , s) ;
203
203
hir_visit:: walk_struct_field ( self , s)
204
204
}
205
205
@@ -212,7 +212,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
212
212
}
213
213
214
214
fn visit_lifetime ( & mut self , lifetime : & ' v hir:: Lifetime ) {
215
- self . record ( "Lifetime" , Id :: Node ( lifetime. id ) , lifetime) ;
215
+ self . record ( "Lifetime" , Id :: Node ( lifetime. hir_id ) , lifetime) ;
216
216
hir_visit:: walk_lifetime ( self , lifetime)
217
217
}
218
218
@@ -234,7 +234,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
234
234
}
235
235
236
236
fn visit_assoc_type_binding ( & mut self , type_binding : & ' v hir:: TypeBinding ) {
237
- self . record ( "TypeBinding" , Id :: Node ( type_binding. id ) , type_binding) ;
237
+ self . record ( "TypeBinding" , Id :: Node ( type_binding. hir_id ) , type_binding) ;
238
238
hir_visit:: walk_assoc_type_binding ( self , type_binding)
239
239
}
240
240
@@ -243,7 +243,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
243
243
}
244
244
245
245
fn visit_macro_def ( & mut self , macro_def : & ' v hir:: MacroDef ) {
246
- self . record ( "MacroDef" , Id :: Node ( macro_def. id ) , macro_def) ;
246
+ self . record ( "MacroDef" , Id :: Node ( macro_def. hir_id ) , macro_def) ;
247
247
hir_visit:: walk_macro_def ( self , macro_def)
248
248
}
249
249
}
0 commit comments