Skip to content

Commit 96f99fe

Browse files
committed
---
yaml --- r: 6091 b: refs/heads/master c: 5b0c103 h: refs/heads/master i: 6089: 3db02e0 6087: 5c754bf v: v3
1 parent ec61a28 commit 96f99fe

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0a20eed2db233dad2eb9594cf28790842970c1d6
2+
refs/heads/master: 5b0c103b39e5392c267e66f8aad380c34c60f5b5

trunk/src/comp/middle/trans.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -3269,12 +3269,13 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
32693269
check (type_has_static_size(ccx, t_out));
32703270
let ll_t_out = type_of(ccx, e.span, t_out);
32713271

3272-
tag kind { native_; integral; float; other; }
3272+
tag kind { pointer; integral; float; other; }
32733273
fn t_kind(tcx: ty::ctxt, t: ty::t) -> kind {
32743274
ret if ty::type_is_fp(tcx, t) {
32753275
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
32783279
} else if ty::type_is_integral(tcx, t) {
32793280
integral
32803281
} else { other };
@@ -3301,13 +3302,13 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
33013302
FPToSI(e_res.bcx, e_res.val, ll_t_out)
33023303
} else { FPToUI(e_res.bcx, e_res.val, ll_t_out) }
33033304
}
3304-
{in: integral., out: native_.} {
3305+
{in: integral., out: pointer.} {
33053306
IntToPtr(e_res.bcx, e_res.val, ll_t_out)
33063307
}
3307-
{in: native_., out: integral.} {
3308+
{in: pointer., out: integral.} {
33083309
PtrToInt(e_res.bcx, e_res.val, ll_t_out)
33093310
}
3310-
{in: native_., out: native_.} {
3311+
{in: pointer., out: pointer.} {
33113312
PointerCast(e_res.bcx, e_res.val, ll_t_out)
33123313
}
33133314
_ { ccx.sess.bug("Translating unsupported cast.") }

trunk/src/comp/middle/ty.rs

+8
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export type_is_bot;
153153
export type_is_box;
154154
export type_is_boxed;
155155
export type_is_unique_box;
156+
export type_is_unsafe_ptr;
156157
export type_is_vec;
157158
export type_is_fp;
158159
export type_allows_implicit_copy;
@@ -885,6 +886,13 @@ pure fn type_is_unique_box(cx: ctxt, ty: t) -> bool {
885886
}
886887
}
887888

889+
pure fn type_is_unsafe_ptr(cx: ctxt, ty: t) -> bool {
890+
alt struct(cx, ty) {
891+
ty_ptr(_) { ret true; }
892+
_ { ret false; }
893+
}
894+
}
895+
888896
pure fn type_is_vec(cx: ctxt, ty: t) -> bool {
889897
ret alt struct(cx, ty) {
890898
ty_vec(_) { true }

0 commit comments

Comments
 (0)