diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 572f94d3382e..10a85cc833a1 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -927,12 +927,6 @@ impl<'hir> Map<'hir> { } } - pub fn expect_expr(&self, id: NodeId) -> &'hir Expr { - let hir_id = self.node_to_hir_id(id); - self.expect_expr_by_hir_id(hir_id) - } - - // FIXME(@ljedrz): replace the `NodeId` variant. pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr { match self.find_by_hir_id(id) { // read recorded by find Some(Node::Expr(expr)) => expr, diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index a7f46e876830..fa7e000106f6 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1531,7 +1531,8 @@ impl<'l, 'tcx, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, ' self.process_macro_use(ex.span); match ex.node { ast::ExprKind::Struct(ref path, ref fields, ref base) => { - let hir_expr = self.save_ctxt.tcx.hir().expect_expr(ex.id); + let expr_hir_id = self.save_ctxt.tcx.hir().node_to_hir_id(ex.id); + let hir_expr = self.save_ctxt.tcx.hir().expect_expr_by_hir_id(expr_hir_id); let adt = match self.save_ctxt.tables.expr_ty_opt(&hir_expr) { Some(ty) if ty.ty_adt_def().is_some() => ty.ty_adt_def().unwrap(), _ => { diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index bc813b3d5a2e..3b0d0622baef 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -513,7 +513,8 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } pub fn get_expr_data(&self, expr: &ast::Expr) -> Option { - let hir_node = self.tcx.hir().expect_expr(expr.id); + let expr_hir_id = self.tcx.hir().node_to_hir_id(expr.id); + let hir_node = self.tcx.hir().expect_expr_by_hir_id(expr_hir_id); let ty = self.tables.expr_ty_adjusted_opt(&hir_node); if ty.is_none() || ty.unwrap().sty == ty::Error { return None;