]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_trans/trans/expr.rs
Address review commets
[rust.git] / src / librustc_trans / trans / expr.rs
index e5c9a81818319c19b43701960e2fa616c60c508b..90741d1d58fbc3e32f4e2f0c886368c8b454b089 100644 (file)
@@ -2086,8 +2086,8 @@ fn float_cast(bcx: Block,
         }
     }
 
-    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 float_cast(bcx: Block,
     };
 
     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),