]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_ast_lowering/src/index.rs
Rollup merge of #100293 - yanchen4791:add-inline-llvm-option, r=nnethercote
[rust.git] / compiler / rustc_ast_lowering / src / index.rs
index 219e1b81d1ea64d3226d9eb93787b1ed2d98fe4d..e732aed5a293a53f1ba99ea8cda5349270201f99 100644 (file)
@@ -69,6 +69,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
     fn insert(&mut self, span: Span, hir_id: HirId, node: Node<'hir>) {
         debug_assert_eq!(self.owner, hir_id.owner);
         debug_assert_ne!(hir_id.local_id.as_u32(), 0);
+        debug_assert_ne!(hir_id.local_id, self.parent_node);
 
         // Make sure that the DepNode of some node coincides with the HirId
         // owner of that node.
@@ -246,9 +247,7 @@ fn visit_stmt(&mut self, stmt: &'hir Stmt<'hir>) {
     }
 
     fn visit_path_segment(&mut self, path_span: Span, path_segment: &'hir PathSegment<'hir>) {
-        if let Some(hir_id) = path_segment.hir_id {
-            self.insert(path_span, hir_id, Node::PathSegment(path_segment));
-        }
+        self.insert(path_span, path_segment.hir_id, Node::PathSegment(path_segment));
         intravisit::walk_path_segment(self, path_span, path_segment);
     }