From 34a25db45f68aa96f1231589f01bdda96a77562a Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 29 Sep 2015 06:47:33 -0400 Subject: [PATCH] stop updating `parent_node_id` when there is no corresponding map entry --- src/librustc/front/map/collector.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/librustc/front/map/collector.rs b/src/librustc/front/map/collector.rs index 0dd51b4ec8a..a252992812e 100644 --- a/src/librustc/front/map/collector.rs +++ b/src/librustc/front/map/collector.rs @@ -248,16 +248,12 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> { fn visit_fn(&mut self, fk: visit::FnKind<'ast>, fd: &'ast FnDecl, b: &'ast Block, s: Span, id: NodeId) { - let parent_node = self.parent_node; - self.parent_node = id; + assert_eq!(self.parent_node, id); self.visit_fn_decl(fd); visit::walk_fn(self, fk, fd, b, s); - self.parent_node = parent_node; } fn visit_ty(&mut self, ty: &'ast Ty) { - let parent_node = self.parent_node; - self.parent_node = ty.id; match ty.node { TyBareFn(ref fd) => { self.visit_fn_decl(&*fd.decl); @@ -265,7 +261,6 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> { _ => {} } visit::walk_ty(self, ty); - self.parent_node = parent_node; } fn visit_block(&mut self, block: &'ast Block) {