Skip to content

Commit

Permalink
Remove expr_ty method completely
Browse files Browse the repository at this point in the history
  • Loading branch information
canndrew committed Sep 5, 2016
1 parent 7c8f545 commit c9a340e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/librustc_typeck/check/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
i, expr, autoderef_count);

if autoderef_count > 0 {
let mut autoderef = self.autoderef(expr.span, self.expr_ty(expr));
let mut autoderef = self.autoderef(expr.span, self.node_ty(expr.id));
autoderef.nth(autoderef_count).unwrap_or_else(|| {
span_bug!(expr.span, "expr was deref-able {} times but now isn't?",
autoderef_count);
Expand Down Expand Up @@ -532,7 +532,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
unsize: None
}))), false)
};
let index_expr_ty = self.expr_ty(&index_expr);
let index_expr_ty = self.node_ty(index_expr.id);

let result = self.try_index_step(
ty::MethodCall::expr(expr.id),
Expand All @@ -547,7 +547,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
if let Some((input_ty, return_ty)) = result {
self.demand_suptype(index_expr.span, input_ty, index_expr_ty);

let expr_ty = self.expr_ty(&expr);
let expr_ty = self.node_ty(expr.id);
self.demand_suptype(expr.span, expr_ty, return_ty);
}
}
Expand All @@ -558,7 +558,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
if self.tables.borrow().method_map.contains_key(&method_call) {
let method = self.try_overloaded_deref(expr.span,
Some(&base_expr),
self.expr_ty(&base_expr),
self.node_ty(base_expr.id),
PreferMutLvalue);
let method = method.expect("re-trying deref failed");
self.tables.borrow_mut().method_map.insert(method_call, method);
Expand Down
13 changes: 0 additions & 13 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1763,19 +1763,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
t
}

pub fn expr_ty(&self, ex: &hir::Expr) -> Ty<'tcx> {
if let Some(&adjustment::AdjustNeverToAny(ref t))
= self.tables.borrow().adjustments.get(&ex.id) {
return t;
}
match self.tables.borrow().node_types.get(&ex.id) {
Some(&t) => t,
None => {
bug!("no type for expr in fcx {}", self.tag());
}
}
}

/// Apply `adjustment` to the type of `expr`
pub fn adjust_expr_ty(&self,
expr: &hir::Expr,
Expand Down

0 comments on commit c9a340e

Please sign in to comment.