rename hir::map::expect_expr_by_hir_id to expect_expr

This commit is contained in:
ljedrz
2019-06-20 10:05:56 +02:00
parent 2d1e223a0e
commit fe044a8bc2
10 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -927,7 +927,7 @@ pub fn expect_foreign_item(&self, id: HirId) -> &'hir ForeignItem {
}
}
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))
+1 -1
View File
@@ -617,7 +617,7 @@ fn note_error_origin(
}
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 @@ pub fn need_type_info_err(
};
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);
}
+1 -1
View File
@@ -702,7 +702,7 @@ pub fn report_use_of_moved_value(&self,
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 @@ fn closure_span(
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 @@ fn give_name_from_error_region(
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 {
+1 -1
View File
@@ -116,7 +116,7 @@ fn visit_expr(&mut self, e: &'hir hir::Expr) {
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,
+1 -1
View File
@@ -1532,7 +1532,7 @@ fn visit_expr(&mut self, ex: &'l ast::Expr) {
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(),
_ => {
+1 -1
View File
@@ -514,7 +514,7 @@ pub fn get_trait_ref_data(&self, trait_ref: &ast::TraitRef) -> Option<Ref> {
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;
+1 -1
View File
@@ -389,7 +389,7 @@ pub fn report_method_error<'b>(
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),
);