diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-04-02 16:13:01 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-07-06 23:09:29 +0200 |
| commit | fb060fb774c7e0f1e06dfb43c6173bc37079dfcd (patch) | |
| tree | 90eaab777e72214091c8bbea8cd3ec8006107b69 | |
| parent | 250c71b85d0eed22982ef2b2db92fd5e63772c42 (diff) | |
| download | rust-fb060fb774c7e0f1e06dfb43c6173bc37079dfcd.tar.gz rust-fb060fb774c7e0f1e06dfb43c6173bc37079dfcd.zip | |
Remove useless branch.
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index ee978f39d22..62682e837dc 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -459,6 +459,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { node_id: ast::NodeId, data: DefPathData, ) -> LocalDefId { + debug_assert_ne!(node_id, ast::DUMMY_NODE_ID); assert!( self.opt_local_def_id(node_id).is_none(), "adding a def'n for node-id {:?} and data {:?} but a previous def'n exists: {:?}", @@ -469,13 +470,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let def_id = self.tcx.create_def(parent, data); - // Some things for which we allocate `LocalDefId`s don't correspond to - // anything in the AST, so they don't have a `NodeId`. For these cases - // we don't need a mapping from `NodeId` to `LocalDefId`. - if node_id != ast::DUMMY_NODE_ID { - debug!("create_def: def_id_to_node_id[{:?}] <-> {:?}", def_id, node_id); - self.resolver.node_id_to_def_id.insert(node_id, def_id); - } + debug!("create_def: def_id_to_node_id[{:?}] <-> {:?}", def_id, node_id); + self.resolver.node_id_to_def_id.insert(node_id, def_id); def_id } |
