@@ -14,16 +14,16 @@ pub(super) struct GatherLocalsVisitor<'a, 'tcx> {
14
14
// params are special cases of pats, but we want to handle them as
15
15
// *distinct* cases. so track when we are hitting a pat *within* an fn
16
16
// param.
17
- within_fn_param : bool ,
17
+ outermost_fn_param_pat : bool ,
18
18
}
19
19
20
20
impl < ' a , ' tcx > GatherLocalsVisitor < ' a , ' tcx > {
21
21
pub ( super ) fn new (
22
22
fcx : & ' a FnCtxt < ' a , ' tcx > ,
23
23
parent_id : hir:: HirId ,
24
- within_fn_param : bool ,
24
+ outermost_fn_param_pat : bool ,
25
25
) -> Self {
26
- Self { fcx, parent_id, within_fn_param }
26
+ Self { fcx, parent_id, outermost_fn_param_pat }
27
27
}
28
28
29
29
fn assign ( & mut self , span : Span , nid : hir:: HirId , ty_opt : Option < LocalTy < ' tcx > > ) -> Ty < ' tcx > {
@@ -98,17 +98,17 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
98
98
}
99
99
100
100
fn visit_param ( & mut self , param : & ' tcx hir:: Param < ' tcx > ) {
101
- let old_within_fn_param = mem:: replace ( & mut self . within_fn_param , true ) ;
101
+ let old_outermost_fn_param_pat = mem:: replace ( & mut self . outermost_fn_param_pat , true ) ;
102
102
intravisit:: walk_param ( self , param) ;
103
- self . within_fn_param = old_within_fn_param ;
103
+ self . outermost_fn_param_pat = old_outermost_fn_param_pat ;
104
104
}
105
105
106
106
// Add pattern bindings.
107
107
fn visit_pat ( & mut self , p : & ' tcx hir:: Pat < ' tcx > ) {
108
108
if let PatKind :: Binding ( _, _, ident, _) = p. kind {
109
109
let var_ty = self . assign ( p. span , p. hir_id , None ) ;
110
110
111
- if self . within_fn_param {
111
+ if self . outermost_fn_param_pat {
112
112
if !self . fcx . tcx . features ( ) . unsized_fn_params {
113
113
self . fcx . require_type_is_sized (
114
114
var_ty,
@@ -129,9 +129,9 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
129
129
var_ty
130
130
) ;
131
131
}
132
- let old_within_fn_param = mem:: replace ( & mut self . within_fn_param , false ) ;
132
+ let old_outermost_fn_param_pat = mem:: replace ( & mut self . outermost_fn_param_pat , false ) ;
133
133
intravisit:: walk_pat ( self , p) ;
134
- self . within_fn_param = old_within_fn_param ;
134
+ self . outermost_fn_param_pat = old_outermost_fn_param_pat ;
135
135
}
136
136
137
137
// Don't descend into the bodies of nested closures.
0 commit comments