1
Fork 0

typeck: Remove Coerce::unpack_actual_value.

This commit is contained in:
Eduard Burtescu 2016-02-21 18:58:08 +02:00
parent dc37664c94
commit dbab236a9e

View file

@ -96,12 +96,6 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
Ok(None) // No coercion required.
}
fn unpack_actual_value<T, F>(&self, a: Ty<'tcx>, f: F) -> T where
F: FnOnce(Ty<'tcx>) -> T,
{
f(self.fcx.infcx().shallow_resolve(a))
}
fn coerce(&self,
expr_a: &hir::Expr,
a: Ty<'tcx>,
@ -353,9 +347,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
* into a closure or a `proc`.
*/
self.unpack_actual_value(b, |b| {
debug!("coerce_from_fn_pointer(a={:?}, b={:?})",
a, b);
let b = self.fcx.infcx().shallow_resolve(b);
debug!("coerce_from_fn_pointer(a={:?}, b={:?})", a, b);
if let ty::TyFnPtr(fn_ty_b) = b.sty {
match (fn_ty_a.unsafety, fn_ty_b.unsafety) {
@ -368,7 +361,6 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
}
}
self.subtype(a, b)
})
}
fn coerce_from_fn_item(&self,
@ -381,9 +373,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
* into a closure or a `proc`.
*/
self.unpack_actual_value(b, |b| {
debug!("coerce_from_fn_item(a={:?}, b={:?})",
a, b);
let b = self.fcx.infcx().shallow_resolve(b);
debug!("coerce_from_fn_item(a={:?}, b={:?})", a, b);
match b.sty {
ty::TyFnPtr(_) => {
@ -393,7 +384,6 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
}
_ => self.subtype(a, b)
}
})
}
fn coerce_unsafe_ptr(&self,