about summary refs log tree commit diff
path: root/src/librustc_save_analysis
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-25 17:15:36 +0200
committerGitHub <noreply@github.com>2019-06-25 17:15:36 +0200
commitabc7423f27cebb55ea9cbc67b3edc8cbcaa5e0eb (patch)
treea9456be8ebd20d834fb93d7f8d67c394f331b1ca /src/librustc_save_analysis
parent6070e2e87616d8b2ae9ea58c800a79be936b9aab (diff)
parent87438a163ec153e2322b70e8c5c987c7c89be0b4 (diff)
downloadrust-abc7423f27cebb55ea9cbc67b3edc8cbcaa5e0eb.tar.gz
rust-abc7423f27cebb55ea9cbc67b3edc8cbcaa5e0eb.zip
Rollup merge of #62091 - ljedrz:hiridification_almost_there, r=Zoxc
HirIdification: almost there

I'm beginning to run out of stuff to HirIdify :wink:.

This time I targeted mainly `hir::map::{find, get_parent_node}`, but a few other bits got changed too.

r? @Zoxc
Diffstat (limited to 'src/librustc_save_analysis')
-rw-r--r--src/librustc_save_analysis/lib.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index 23fe150c6ff..19ed9e21407 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(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(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(sub_ex_hir_id) {
                     Some(Node::Expr(expr)) => expr,
                     _ => {
                         debug!(
@@ -621,7 +626,10 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
             Node::PathSegment(seg) => {
                 match seg.res {
                     Some(res) if res != Res::Err => res,
-                    _ => self.get_path_res(self.tcx.hir().get_parent_node(id)),
+                    _ => {
+                        let parent_node = self.tcx.hir().get_parent_node(hir_id);
+                        self.get_path_res(self.tcx.hir().hir_to_node_id(parent_node))
+                    },
                 }
             }