Skip to content

Commit 2d1e223

Browse files
committed
remove uses of the NodeId hir::map::expr
1 parent 21e63dd commit 2d1e223

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -927,12 +927,6 @@ impl<'hir> Map<'hir> {
927927
}
928928
}
929929

930-
pub fn expect_expr(&self, id: NodeId) -> &'hir Expr {
931-
let hir_id = self.node_to_hir_id(id);
932-
self.expect_expr_by_hir_id(hir_id)
933-
}
934-
935-
// FIXME(@ljedrz): replace the `NodeId` variant.
936930
pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr {
937931
match self.find_by_hir_id(id) { // read recorded by find
938932
Some(Node::Expr(expr)) => expr,

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,8 @@ impl<'l, 'tcx, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, '
15311531
self.process_macro_use(ex.span);
15321532
match ex.node {
15331533
ast::ExprKind::Struct(ref path, ref fields, ref base) => {
1534-
let hir_expr = self.save_ctxt.tcx.hir().expect_expr(ex.id);
1534+
let expr_hir_id = self.save_ctxt.tcx.hir().node_to_hir_id(ex.id);
1535+
let hir_expr = self.save_ctxt.tcx.hir().expect_expr_by_hir_id(expr_hir_id);
15351536
let adt = match self.save_ctxt.tables.expr_ty_opt(&hir_expr) {
15361537
Some(ty) if ty.ty_adt_def().is_some() => ty.ty_adt_def().unwrap(),
15371538
_ => {

src/librustc_save_analysis/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
513513
}
514514

515515
pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
516-
let hir_node = self.tcx.hir().expect_expr(expr.id);
516+
let expr_hir_id = self.tcx.hir().node_to_hir_id(expr.id);
517+
let hir_node = self.tcx.hir().expect_expr_by_hir_id(expr_hir_id);
517518
let ty = self.tables.expr_ty_adjusted_opt(&hir_node);
518519
if ty.is_none() || ty.unwrap().sty == ty::Error {
519520
return None;

0 commit comments

Comments
 (0)