Remove NodeId
to HirId
conversion APIs
This commit is contained in:
parent
936b6bfa64
commit
a98f35f503
@ -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];
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user