@@ -3269,12 +3269,13 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
3269
3269
check ( type_has_static_size ( ccx, t_out) ) ;
3270
3270
let ll_t_out = type_of ( ccx, e. span , t_out) ;
3271
3271
3272
- tag kind { native_ ; integral; float; other; }
3272
+ tag kind { pointer ; integral; float; other; }
3273
3273
fn t_kind ( tcx : ty:: ctxt , t : ty:: t ) -> kind {
3274
3274
ret if ty:: type_is_fp ( tcx, t) {
3275
3275
float
3276
- } else if ty:: type_is_native ( tcx, t) {
3277
- native_
3276
+ } else if ty:: type_is_native ( tcx, t) ||
3277
+ ty:: type_is_unsafe_ptr ( tcx, t) {
3278
+ pointer
3278
3279
} else if ty:: type_is_integral ( tcx, t) {
3279
3280
integral
3280
3281
} else { other } ;
@@ -3301,13 +3302,13 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
3301
3302
FPToSI ( e_res. bcx , e_res. val , ll_t_out)
3302
3303
} else { FPToUI ( e_res. bcx , e_res. val , ll_t_out) }
3303
3304
}
3304
- { in: integral. , out: native_ . } {
3305
+ { in: integral. , out: pointer . } {
3305
3306
IntToPtr ( e_res. bcx , e_res. val , ll_t_out)
3306
3307
}
3307
- { in: native_ . , out: integral . } {
3308
+ { in: pointer . , out: integral . } {
3308
3309
PtrToInt ( e_res. bcx , e_res. val , ll_t_out)
3309
3310
}
3310
- { in: native_ . , out: native_ . } {
3311
+ { in: pointer . , out: pointer . } {
3311
3312
PointerCast ( e_res. bcx , e_res. val , ll_t_out)
3312
3313
}
3313
3314
_ { ccx. sess . bug ( "Translating unsupported cast." ) }
0 commit comments