diff options
| author | ljedrz <ljedrz@gmail.com> | 2019-06-24 09:55:11 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2019-06-24 09:55:11 +0200 |
| commit | 90de9edce576d03bd6e7e5d294fa44d8d1ef8a5a (patch) | |
| tree | c199d524760b5a905b0b2b885659da7b1fe244bf /src/librustc_save_analysis | |
| parent | d08bd72e977d05f7fe6d1140e10d7311f64f0f21 (diff) | |
| download | rust-90de9edce576d03bd6e7e5d294fa44d8d1ef8a5a.tar.gz rust-90de9edce576d03bd6e7e5d294fa44d8d1ef8a5a.zip | |
HIR: remove the NodeId find
Diffstat (limited to 'src/librustc_save_analysis')
| -rw-r--r-- | src/librustc_save_analysis/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
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!( |
