about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-12-02 13:59:27 -0500
committerNiko Matsakis <niko@alum.mit.edu>2014-12-19 03:29:29 -0500
commit7be059ffcd640096911b62b9135d2ffbf3a05abc (patch)
tree95c543725067b424c2cc2c545e3def5df64c9bca /src
parent5a6a26acd616ba87129ad1f50ba64d66ade82bc5 (diff)
downloadrust-7be059ffcd640096911b62b9135d2ffbf3a05abc.tar.gz
rust-7be059ffcd640096911b62b9135d2ffbf3a05abc.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/check/mod.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index ea33153f3b1..eabf52c2cc8 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -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);