about summary refs log tree commit diff
path: root/src/librustc_trans/trans/expr.rs
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2015-05-14 15:04:49 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2015-05-19 17:42:14 +0300
commit32fe2e3ad452128d17ab1ce15f2c77b8cb42a3ea (patch)
treebca08ed0c097aa5c2e0c1f3b91a873f3e3366be1 /src/librustc_trans/trans/expr.rs
parentde4b0e996192d6784e0a65c66d095a6198894c47 (diff)
downloadrust-32fe2e3ad452128d17ab1ce15f2c77b8cb42a3ea.tar.gz
rust-32fe2e3ad452128d17ab1ce15f2c77b8cb42a3ea.zip
Address review commets
I think I didn't run tests properly - my second call to
select_all_obligations_or_error has made 3 tests fail. However, this is
just an error message change - integer fallback never worked with casts.
Diffstat (limited to 'src/librustc_trans/trans/expr.rs')
-rw-r--r--src/librustc_trans/trans/expr.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index e5c9a818183..90741d1d58f 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -2086,8 +2086,8 @@ fn trans_imm_cast<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }
     }
 
-    let r_t_in = CastTy::recognize(bcx.tcx(), t_in).expect("bad input type for cast");
-    let r_t_out = CastTy::recognize(bcx.tcx(), t_out).expect("bad output type for cast");
+    let r_t_in = CastTy::from_ty(bcx.tcx(), t_in).expect("bad input type for cast");
+    let r_t_out = CastTy::from_ty(bcx.tcx(), t_out).expect("bad output type for cast");
 
     let (llexpr, signed) = if let Int(CEnum) = r_t_in {
         let repr = adt::represent_type(ccx, t_in);
@@ -2102,8 +2102,10 @@ fn trans_imm_cast<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     };
 
     let newval = match (r_t_in, r_t_out) {
-        (Ptr(_), Ptr(_)) | (FPtr, Ptr(_)) | (RPtr(_), Ptr(_)) => PointerCast(bcx, llexpr, ll_t_out),
-        (Ptr(_), Int(_)) | (FPtr, Int(_)) => PtrToInt(bcx, llexpr, ll_t_out),
+        (Ptr(_), Ptr(_)) | (FnPtr, Ptr(_)) | (RPtr(_), Ptr(_)) => {
+            PointerCast(bcx, llexpr, ll_t_out)
+        }
+        (Ptr(_), Int(_)) | (FnPtr, Int(_)) => PtrToInt(bcx, llexpr, ll_t_out),
         (Int(_), Ptr(_)) => IntToPtr(bcx, llexpr, ll_t_out),
 
         (Int(_), Int(_)) => int_cast(bcx, ll_t_out, ll_t_in, llexpr, signed),