Properly restore within_fn_param value to the previous state
This commit is contained in:
parent
a3470b13ab
commit
58018d438b
@ -6,6 +6,7 @@
|
||||
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>,
|
||||
@ -97,9 +98,9 @@ fn visit_local(&mut self, local: &'tcx hir::Local<'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.
|
||||
|
Loading…
Reference in New Issue
Block a user