Skip to content

Commit

Permalink
Properly restore within_fn_param value to the previous state
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Oct 27, 2020
1 parent a3470b1 commit 58018d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_typeck/src/check/gather_locals.rs
Expand Up @@ -6,6 +6,7 @@ use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKi
use rustc_middle::ty::Ty;
use rustc_span::Span;
use rustc_trait_selection::traits;
use std::mem;

pub(super) struct GatherLocalsVisitor<'a, 'tcx> {
fcx: &'a FnCtxt<'a, 'tcx>,
Expand Down Expand Up @@ -97,9 +98,9 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
}

fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) {
self.within_fn_param = true;
let old_within_fn_param = mem::replace(&mut self.within_fn_param, true);
intravisit::walk_param(self, param);
self.within_fn_param = false;
self.within_fn_param = old_within_fn_param;
}

// Add pattern bindings.
Expand Down

0 comments on commit 58018d4

Please sign in to comment.