about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2022-01-26 09:53:17 -0300
committerSantiago Pastorino <spastorino@gmail.com>2022-01-26 12:25:31 -0300
commit384189c3d9af20146a4bcef382eca4f0ff9fe47e (patch)
treec7f19c755f90999506d952ecd95220ed42bf2da1
parent14a64e0a5565891625a4bda84f562965aab28375 (diff)
downloadrust-384189c3d9af20146a4bcef382eca4f0ff9fe47e.tar.gz
rust-384189c3d9af20146a4bcef382eca4f0ff9fe47e.zip
Filter out local_id == 0, those are already considered on the call site
-rw-r--r--compiler/rustc_ast_lowering/src/lib.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index cc14f48b6bd..32cec3a295a 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -483,9 +483,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
         let local_id_to_def_id = local_node_ids
             .iter()
             .filter_map(|&node_id| {
-                let def_id = self.resolver.opt_local_def_id(node_id)?;
                 let hir_id = self.node_id_to_hir_id[node_id]?;
-                Some((hir_id.local_id, def_id))
+                if hir_id.local_id == hir::ItemLocalId::new(0) {
+                    None
+                } else {
+                    let def_id = self.resolver.opt_local_def_id(node_id)?;
+                    Some((hir_id.local_id, def_id))
+                }
             })
             .collect();