diff options
| author | ljedrz <ljedrz@gmail.com> | 2019-06-20 09:55:21 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2019-06-20 12:47:26 +0200 |
| commit | 2d1e223a0e61e93aaeeef01a0e4a71ee2234aa06 (patch) | |
| tree | 8a8d9237cd1285a30758ef7cfe26ab84b887fddf | |
| parent | 21e63dddbeca3ab15cf365f9bd8dbb8a188c1d9b (diff) | |
| download | rust-2d1e223a0e61e93aaeeef01a0e4a71ee2234aa06.tar.gz rust-2d1e223a0e61e93aaeeef01a0e4a71ee2234aa06.zip | |
remove uses of the NodeId hir::map::expr
| -rw-r--r-- | src/librustc/hir/map/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustc_save_analysis/dump_visitor.rs | 3 | ||||
| -rw-r--r-- | src/librustc_save_analysis/lib.rs | 3 |
3 files changed, 4 insertions, 8 deletions
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 572f94d3382..10a85cc833a 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 a7f46e87683..fa7e000106f 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 bc813b3d5a2..3b0d0622bae 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<Data> { - 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; |
