Skip to content

Commit 8ce6b0d

Browse files
committed
rustc: Add appropriate type predicates for references. Simple uses of references/region pointers now work.
1 parent 256146b commit 8ce6b0d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/rustc/middle/ty.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ pure fn type_is_unique(ty: t) -> bool {
739739
pure fn type_is_scalar(ty: t) -> bool {
740740
alt get(ty).struct {
741741
ty_nil | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
742-
ty_send_type | ty_type | ty_ptr(_) { true }
742+
ty_send_type | ty_type | ty_ptr(_) | ty_rptr(_, _) { true }
743743
_ { false }
744744
}
745745
}
@@ -760,7 +760,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
760760
let result = alt get(ty).struct {
761761
// scalar types
762762
ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
763-
ty_type | ty_ptr(_) { false }
763+
ty_type | ty_ptr(_) | ty_rptr(_, _) { false }
764764
ty_rec(flds) {
765765
for f in flds { if type_needs_drop(cx, f.mt.ty) { accum = true; } }
766766
accum
@@ -852,6 +852,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
852852
// Those with refcounts-to-inner raise pinned to shared,
853853
// lower unique to shared. Therefore just set result to shared.
854854
ty_box(_) | ty_iface(_, _) | ty_opaque_box { kind_copyable }
855+
ty_rptr(_, _) { kind_copyable }
855856
// Boxes and unique pointers raise pinned to shared.
856857
ty_vec(tm) | ty_uniq(tm) { type_kind(cx, tm.ty) }
857858
// Records lower to the lowest of their members.
@@ -1012,7 +1013,7 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
10121013
ty_send_type | ty_type | ty_ptr(_) { result = true; }
10131014
// Boxed types
10141015
ty_str | ty_box(_) | ty_uniq(_) | ty_vec(_) | ty_fn(_) |
1015-
ty_iface(_, _) | ty_opaque_box { result = false; }
1016+
ty_iface(_, _) | ty_rptr(_,_) | ty_opaque_box { result = false; }
10161017
// Structural types
10171018
ty_enum(did, tps) {
10181019
let variants = enum_variants(cx, did);

0 commit comments

Comments
 (0)