1
Fork 0

Propagate expected type more widely so that we can rewrite the

issue-14039 test in a more natural way. Previously the "type we will
cast to" was hidden unless it was an integer.
This commit is contained in:
Niko Matsakis 2014-12-02 13:59:27 -05:00
parent 5a6a26acd6
commit 7be059ffcd

View file

@ -1390,13 +1390,7 @@ fn check_cast(fcx: &FnCtxt,
let t_1 = fcx.to_ty(t);
let t_1 = structurally_resolved_type(fcx, span, t_1);
if ty::type_is_scalar(t_1) {
// Supply the type as a hint so as to influence integer
// literals and other things that might care.
check_expr_with_expectation(fcx, e, ExpectCastableToType(t_1))
} else {
check_expr(fcx, e)
}
check_expr_with_expectation(fcx, e, ExpectCastableToType(t_1));
let t_e = fcx.expr_ty(e);