rename hir::map::expect_expr_by_hir_id to expect_expr
This commit is contained in:
parent
2d1e223a0e
commit
fe044a8bc2
10 changed files with 10 additions and 10 deletions
|
@ -927,7 +927,7 @@ impl<'hir> Map<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr {
|
||||
pub fn expect_expr(&self, id: HirId) -> &'hir Expr {
|
||||
match self.find_by_hir_id(id) { // read recorded by find
|
||||
Some(Node::Expr(expr)) => expr,
|
||||
_ => bug!("expected expr, found {}", self.node_to_string(id))
|
||||
|
|
|
@ -617,7 +617,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
hir::MatchSource::TryDesugar => {
|
||||
if let Some(ty::error::ExpectedFound { expected, .. }) = exp_found {
|
||||
let discrim_expr = self.tcx.hir().expect_expr_by_hir_id(discrim_hir_id);
|
||||
let discrim_expr = self.tcx.hir().expect_expr(discrim_hir_id);
|
||||
let discrim_ty = if let hir::ExprKind::Call(_, args) = &discrim_expr.node {
|
||||
let arg_expr = args.first().expect("try desugaring call w/out arg");
|
||||
self.in_progress_tables.and_then(|tables| {
|
||||
|
|
|
@ -133,7 +133,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
};
|
||||
|
||||
if let Some(body_id) = body_id {
|
||||
let expr = self.tcx.hir().expect_expr_by_hir_id(body_id.hir_id);
|
||||
let expr = self.tcx.hir().expect_expr(body_id.hir_id);
|
||||
local_visitor.visit_expr(expr);
|
||||
}
|
||||
|
||||
|
|
|
@ -702,7 +702,7 @@ impl BorrowckCtxt<'_, 'tcx> {
|
|||
move_data::MovePat => (self.tcx.hir().span(hir_id), ""),
|
||||
|
||||
move_data::Captured =>
|
||||
(match self.tcx.hir().expect_expr_by_hir_id(hir_id).node {
|
||||
(match self.tcx.hir().expect_expr(hir_id).node {
|
||||
hir::ExprKind::Closure(.., fn_decl_span, _) => fn_decl_span,
|
||||
ref r => bug!("Captured({:?}) maps to non-closure: {:?}",
|
||||
the_move.id, r),
|
||||
|
|
|
@ -659,7 +659,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
def_id, target_place, places
|
||||
);
|
||||
let hir_id = self.infcx.tcx.hir().as_local_hir_id(def_id)?;
|
||||
let expr = &self.infcx.tcx.hir().expect_expr_by_hir_id(hir_id).node;
|
||||
let expr = &self.infcx.tcx.hir().expect_expr(hir_id).node;
|
||||
debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
|
||||
if let hir::ExprKind::Closure(
|
||||
.., args_span, _
|
||||
|
|
|
@ -237,7 +237,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
|
||||
if let DefiningTy::Closure(def_id, substs) = def_ty {
|
||||
let args_span = if let hir::ExprKind::Closure(_, _, _, span, _) =
|
||||
tcx.hir().expect_expr_by_hir_id(mir_hir_id).node
|
||||
tcx.hir().expect_expr(mir_hir_id).node
|
||||
{
|
||||
span
|
||||
} else {
|
||||
|
|
|
@ -116,7 +116,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
|
|||
let loop_kind = if loop_id == hir::DUMMY_HIR_ID {
|
||||
None
|
||||
} else {
|
||||
Some(match self.hir_map.expect_expr_by_hir_id(loop_id).node {
|
||||
Some(match self.hir_map.expect_expr(loop_id).node {
|
||||
hir::ExprKind::While(..) => LoopKind::WhileLoop,
|
||||
hir::ExprKind::Loop(_, _, source) => LoopKind::Loop(source),
|
||||
ref r => span_bug!(e.span,
|
||||
|
|
|
@ -1532,7 +1532,7 @@ impl<'l, 'tcx, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, '
|
|||
match ex.node {
|
||||
ast::ExprKind::Struct(ref path, ref fields, ref base) => {
|
||||
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 hir_expr = self.save_ctxt.tcx.hir().expect_expr(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(),
|
||||
_ => {
|
||||
|
|
|
@ -514,7 +514,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
|||
|
||||
pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
|
||||
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 hir_node = self.tcx.hir().expect_expr(expr_hir_id);
|
||||
let ty = self.tables.expr_ty_adjusted_opt(&hir_node);
|
||||
if ty.is_none() || ty.unwrap().sty == ty::Error {
|
||||
return None;
|
||||
|
|
|
@ -389,7 +389,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else {
|
||||
let call_expr = self.tcx.hir().expect_expr_by_hir_id(
|
||||
let call_expr = self.tcx.hir().expect_expr(
|
||||
self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue