diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index f47aed2d8c5..7e463ae9646 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1445,6 +1445,7 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v, @ty.t t) -> result { bind drop_ty(_, _, _)); } else if (ty.type_is_scalar(t) || + ty.type_is_native(t) || ty.type_is_nil(t)) { ret res(cx, C_nil()); } @@ -1927,7 +1928,7 @@ fn copy_ty(@block_ctxt cx, ValueRef dst, ValueRef src, @ty.t t) -> result { - if (ty.type_is_scalar(t)) { + if (ty.type_is_scalar(t) || ty.type_is_native(t)) { ret res(cx, cx.build.Store(src, dst)); } else if (ty.type_is_nil(t)) { @@ -3795,7 +3796,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result { fn load_scalar_or_boxed(@block_ctxt cx, ValueRef v, @ty.t t) -> ValueRef { - if (ty.type_is_scalar(t) || ty.type_is_boxed(t)) { + if (ty.type_is_scalar(t) || ty.type_is_boxed(t) || ty.type_is_native(t)) { ret cx.build.Load(v); } else { ret v; diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 771136da447..c85892f2a90 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -465,6 +465,16 @@ fn type_is_scalar(@t ty) -> bool { fail; } +// FIXME: should we just return true for native types in +// type_is_scalar? +fn type_is_native(@t ty) -> bool { + alt (ty.struct) { + case (ty_native) { ret true; } + case (_) { ret false; } + } + fail; +} + fn type_has_dynamic_size(@t ty) -> bool { alt (ty.struct) { case (ty_tup(?ts)) {