From 90de9edce576d03bd6e7e5d294fa44d8d1ef8a5a Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 24 Jun 2019 09:55:11 +0200 Subject: HIR: remove the NodeId find --- src/librustc_save_analysis/lib.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/librustc_save_analysis') diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 750222451db..3d88b2347c1 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -410,7 +410,10 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { let mut decl_id = None; let mut docs = String::new(); let mut attrs = vec![]; - if let Some(Node::ImplItem(item)) = self.tcx.hir().find(id) { + let hir_id = self.tcx.hir().node_to_hir_id(id); + if let Some(Node::ImplItem(item)) = + self.tcx.hir().find_by_hir_id(hir_id) + { docs = self.docs_for_attrs(&item.attrs); attrs = item.attrs.to_vec(); } @@ -451,8 +454,9 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { Some(def_id) => { let mut docs = String::new(); let mut attrs = vec![]; + let hir_id = self.tcx.hir().node_to_hir_id(id); - if let Some(Node::TraitItem(item)) = self.tcx.hir().find(id) { + if let Some(Node::TraitItem(item)) = self.tcx.hir().find_by_hir_id(hir_id) { docs = self.docs_for_attrs(&item.attrs); attrs = item.attrs.to_vec(); } @@ -521,7 +525,8 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } match expr.node { ast::ExprKind::Field(ref sub_ex, ident) => { - let hir_node = match self.tcx.hir().find(sub_ex.id) { + let sub_ex_hir_id = self.tcx.hir().node_to_hir_id(sub_ex.id); + let hir_node = match self.tcx.hir().find_by_hir_id(sub_ex_hir_id) { Some(Node::Expr(expr)) => expr, _ => { debug!( -- cgit 1.4.1-3-g733a5