Skip to content

Commit 0f1f5e6

Browse files
committed
Create correct drop glue for istrs. Issue #855
1 parent fd8ca2c commit 0f1f5e6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/comp/middle/trans.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,10 @@ fn make_drop_glue(cx: &@block_ctxt, v0: ValueRef, t: ty::t) {
14261426
let rslt = iter_structural_ty(cx, v1, t, drop_ty);
14271427
maybe_free_ivec_heap_part(rslt.bcx, v1, tm.ty)
14281428
}
1429+
ty::ty_istr. {
1430+
maybe_free_ivec_heap_part(cx, v0,
1431+
ty::mk_mach(ccx.tcx, ast::ty_u8))
1432+
}
14291433
ty::ty_box(_) { decr_refcnt_maybe_free(cx, v0, v0, t) }
14301434
ty::ty_uniq(_) { trans_shared_free(cx, cx.build.Load(v0)) }
14311435
ty::ty_obj(_) {

src/test/run-pass/istr.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ fn test_heap_lit() {
1111
~"a big string";
1212
}
1313

14+
fn test_heap_assign() {
15+
let s: istr;
16+
s = ~"AAAA";
17+
}
18+
1419
fn main() {
1520
test_stack_assign();
1621
test_heap_lit();
22+
test_heap_assign();
1723
}

0 commit comments

Comments
 (0)