@@ -165,6 +165,9 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
165
165
fn visit_arm ( & mut self , a : & ' tcx hir:: Arm < ' tcx > ) {
166
166
visit_arm ( self , a) ;
167
167
}
168
+ fn visit_param ( & mut self , p : & ' tcx hir:: Param < ' tcx > ) {
169
+ visit_param ( self , p) ;
170
+ }
168
171
}
169
172
170
173
fn check_mod_liveness ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
@@ -334,21 +337,6 @@ fn visit_fn<'tcx>(
334
337
}
335
338
}
336
339
337
- for param in body. params {
338
- let is_shorthand = match param. pat . kind {
339
- rustc_hir:: PatKind :: Struct ( ..) => true ,
340
- _ => false ,
341
- } ;
342
- param. pat . each_binding ( |_bm, hir_id, _x, ident| {
343
- let var = if is_shorthand {
344
- Local ( LocalInfo { id : hir_id, name : ident. name , is_shorthand : true } )
345
- } else {
346
- Param ( hir_id, ident. name )
347
- } ;
348
- fn_maps. add_variable ( var) ;
349
- } )
350
- }
351
-
352
340
// gather up the various local variables, significant expressions,
353
341
// and so forth:
354
342
intravisit:: walk_fn ( & mut fn_maps, fk, decl, body_id, sp, id) ;
@@ -415,6 +403,22 @@ fn visit_arm<'tcx>(ir: &mut IrMaps<'tcx>, arm: &'tcx hir::Arm<'tcx>) {
415
403
intravisit:: walk_arm ( ir, arm) ;
416
404
}
417
405
406
+ fn visit_param < ' tcx > ( ir : & mut IrMaps < ' tcx > , param : & ' tcx hir:: Param < ' tcx > ) {
407
+ let is_shorthand = match param. pat . kind {
408
+ rustc_hir:: PatKind :: Struct ( ..) => true ,
409
+ _ => false ,
410
+ } ;
411
+ param. pat . each_binding ( |_bm, hir_id, _x, ident| {
412
+ let var = if is_shorthand {
413
+ Local ( LocalInfo { id : hir_id, name : ident. name , is_shorthand : true } )
414
+ } else {
415
+ Param ( hir_id, ident. name )
416
+ } ;
417
+ ir. add_variable ( var) ;
418
+ } ) ;
419
+ intravisit:: walk_param ( ir, param) ;
420
+ }
421
+
418
422
fn visit_expr < ' tcx > ( ir : & mut IrMaps < ' tcx > , expr : & ' tcx Expr < ' tcx > ) {
419
423
match expr. kind {
420
424
// live nodes required for uses or definitions of variables:
0 commit comments