]> 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 a0547497b1926ea0bb041154a91f96636b78889b..e732aed5a293a53f1ba99ea8cda5349270201f99 100644 (file)
@@ -11,8 +11,6 @@
 use rustc_span::source_map::SourceMap;
 use rustc_span::{Span, DUMMY_SP};
 
-use tracing::debug;
-
 /// A visitor that walks over the HIR and collects `Node`s into a HIR map.
 pub(super) struct NodeCollector<'a, 'hir> {
     /// Source map
@@ -71,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.
@@ -248,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);
     }