Skip to content

Commit 68670f6

Browse files
committed
Make type_is_pod handle more types.
1 parent e6c613f commit 68670f6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/rustc/middle/ty.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,8 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
18761876
ty_type | ty_ptr(_) { result = true; }
18771877
// Boxed types
18781878
ty_str | ty_box(_) | ty_uniq(_) | ty_vec(_) | ty_fn(_) |
1879+
ty_estr(vstore_uniq) | ty_estr(vstore_box) |
1880+
ty_evec(_, vstore_uniq) | ty_evec(_, vstore_box) |
18791881
ty_iface(_, _) | ty_rptr(_,_) | ty_opaque_box { result = false; }
18801882
// Structural types
18811883
ty_enum(did, substs) {
@@ -1897,7 +1899,7 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
18971899
for elts.each {|elt| if !type_is_pod(cx, elt) { result = false; } }
18981900
}
18991901
ty_estr(vstore_fixed(_)) { result = true; }
1900-
ty_evec(mt, vstore_fixed(_)) {
1902+
ty_evec(mt, vstore_fixed(_)) | ty_unboxed_vec(mt) {
19011903
result = type_is_pod(cx, mt.ty);
19021904
}
19031905
ty_res(_, inner, substs) {
@@ -1913,7 +1915,14 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
19131915
type_is_pod(cx, sty)
19141916
};
19151917
}
1916-
_ { cx.sess.bug("unexpected type in type_is_pod"); }
1918+
1919+
ty_estr(vstore_slice(*)) | ty_evec(_, vstore_slice(*)) {
1920+
result = false;
1921+
}
1922+
1923+
ty_var(*) | ty_var_integral(*) | ty_self(*) {
1924+
cx.sess.bug("non concrete type in type_is_pod");
1925+
}
19171926
}
19181927

19191928
ret result;

0 commit comments

Comments
 (0)