Create correct drop glue for istrs. Issue #855

This commit is contained in:
Brian Anderson 2011-08-22 14:33:31 -07:00
parent fd8ca2cf5d
commit 0f1f5e67ea
2 changed files with 10 additions and 0 deletions

View File

@ -1426,6 +1426,10 @@ fn make_drop_glue(cx: &@block_ctxt, v0: ValueRef, t: ty::t) {
let rslt = iter_structural_ty(cx, v1, t, drop_ty);
maybe_free_ivec_heap_part(rslt.bcx, v1, tm.ty)
}
ty::ty_istr. {
maybe_free_ivec_heap_part(cx, v0,
ty::mk_mach(ccx.tcx, ast::ty_u8))
}
ty::ty_box(_) { decr_refcnt_maybe_free(cx, v0, v0, t) }
ty::ty_uniq(_) { trans_shared_free(cx, cx.build.Load(v0)) }
ty::ty_obj(_) {

View File

@ -11,7 +11,13 @@ fn test_heap_lit() {
~"a big string";
}
fn test_heap_assign() {
let s: istr;
s = ~"AAAA";
}
fn main() {
test_stack_assign();
test_heap_lit();
test_heap_assign();
}