Skip to content

Commit 0ad0142

Browse files
committed
Don't set cx.parent to None; it seems unnecessary.
1 parent 227f933 commit 0ad0142

File tree

1 file changed

+1
-2
lines changed
  • compiler/rustc_hir_analysis/src/check

1 file changed

+1
-2
lines changed

compiler/rustc_hir_analysis/src/check/region.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -849,13 +849,12 @@ impl<'tcx> Visitor<'tcx> for ScopeResolutionVisitor<'tcx> {
849849
self.enter_body(body.value.hir_id, |this| {
850850
if this.tcx.hir_body_owner_kind(owner_id).is_fn_or_closure() {
851851
// The arguments and `self` are parented to the fn.
852-
this.cx.var_parent = this.cx.parent.take();
852+
this.cx.var_parent = this.cx.parent;
853853
for param in body.params {
854854
this.visit_pat(param.pat);
855855
}
856856

857857
// The body of the every fn is a root scope.
858-
this.cx.parent = this.cx.var_parent;
859858
this.visit_expr(body.value)
860859
} else {
861860
// Only functions have an outer terminating (drop) scope, while

0 commit comments

Comments
 (0)