From a98f35f503ad4df9c6083d01447700c57436a0bc Mon Sep 17 00:00:00 2001 From: marmeladema Date: Fri, 12 Jun 2020 18:36:58 +0100 Subject: [PATCH] Remove `NodeId` to `HirId` conversion APIs --- src/librustc_hir/definitions.rs | 12 +----------- src/librustc_middle/hir/map/collector.rs | 1 - 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/librustc_hir/definitions.rs b/src/librustc_hir/definitions.rs index b63dd653c4d..679fd1668dd 100644 --- a/src/librustc_hir/definitions.rs +++ b/src/librustc_hir/definitions.rs @@ -328,7 +328,7 @@ pub fn opt_local_def_id(&self, node: ast::NodeId) -> Option { #[inline] pub fn local_def_id(&self, node: ast::NodeId) -> LocalDefId { self.opt_local_def_id(node).unwrap_or_else(|| { - panic!("no entry for node id: `{:?}` / `{:?}`", node, self.opt_node_id_to_hir_id(node)) + panic!("no entry for node id: `{:?}` / `{:?}`", node, self.node_id_to_hir_id.get(node)) }) } @@ -342,16 +342,6 @@ pub fn hir_id_to_node_id(&self, hir_id: hir::HirId) -> ast::NodeId { self.hir_id_to_node_id[&hir_id] } - #[inline] - pub fn node_id_to_hir_id(&self, node_id: ast::NodeId) -> hir::HirId { - self.node_id_to_hir_id[node_id].unwrap() - } - - #[inline] - pub fn opt_node_id_to_hir_id(&self, node_id: ast::NodeId) -> Option { - self.node_id_to_hir_id[node_id] - } - #[inline] pub fn local_def_id_to_hir_id(&self, id: LocalDefId) -> hir::HirId { let node_id = self.def_id_to_node_id[id]; diff --git a/src/librustc_middle/hir/map/collector.rs b/src/librustc_middle/hir/map/collector.rs index 2b3c21daa46..ae169976698 100644 --- a/src/librustc_middle/hir/map/collector.rs +++ b/src/librustc_middle/hir/map/collector.rs @@ -243,7 +243,6 @@ fn insert_with_hash(&mut self, span: Span, hir_id: HirId, node: Node<'hir>, hash // owner of that node. if cfg!(debug_assertions) { let node_id = self.definitions.hir_id_to_node_id(hir_id); - assert_eq!(self.definitions.node_id_to_hir_id(node_id), hir_id); if hir_id.owner != self.current_dep_node_owner { let node_str = match self.definitions.opt_local_def_id(node_id) {