Remove NodeId to HirId conversion APIs

This commit is contained in:
marmeladema 2020-06-12 18:36:58 +01:00
parent 936b6bfa64
commit a98f35f503
2 changed files with 1 additions and 12 deletions

View File

@ -328,7 +328,7 @@ pub fn opt_local_def_id(&self, node: ast::NodeId) -> Option<LocalDefId> {
#[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<hir::HirId> {
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];

View File

@ -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) {