Skip to content

Commit 1f315b0

Browse files
committed
---
yaml --- r: 4552 b: refs/heads/master c: 7b337e3 h: refs/heads/master v: v3
1 parent 29f8139 commit 1f315b0

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a5d5f9ef4871d5340f8a7820309ed6ea97648058
2+
refs/heads/master: 7b337e35810a25b53da76aa9d873b6b74081da72

trunk/src/comp/middle/trans.rs

+28-5
Original file line numberDiff line numberDiff line change
@@ -1292,11 +1292,22 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
12921292
// FIXME: switch gc/non-gc on layer of the type.
12931293
let rs =
12941294
alt ty::struct(bcx_tcx(cx), t) {
1295-
ty::ty_str. { let v = cx.build.Load(v0); trans_non_gc_free(cx, v) }
1295+
ty::ty_str. {
1296+
let v = cx.build.Load(v0);
1297+
if !bcx_ccx(cx).sess.get_opts().do_gc {
1298+
trans_non_gc_free(cx, v)
1299+
} else {
1300+
rslt(cx, C_nil())
1301+
}
1302+
}
12961303
ty::ty_vec(_) {
12971304
let v = cx.build.Load(v0);
12981305
let rs = iter_sequence(cx, v, t, bind drop_ty(_, _, _));
1299-
trans_non_gc_free(rs.bcx, v)
1306+
if !bcx_ccx(cx).sess.get_opts().do_gc {
1307+
trans_non_gc_free(rs.bcx, v)
1308+
} else {
1309+
rslt(cx, C_nil())
1310+
}
13001311
}
13011312
ty::ty_box(body_mt) {
13021313
let v = cx.build.Load(v0);
@@ -1305,7 +1316,11 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
13051316
let body_ty = body_mt.ty;
13061317
let body_val = load_if_immediate(cx, body, body_ty);
13071318
let rs = drop_ty(cx, body_val, body_ty);
1308-
trans_non_gc_free(rs.bcx, v)
1319+
if !bcx_ccx(cx).sess.get_opts().do_gc {
1320+
trans_non_gc_free(rs.bcx, v)
1321+
} else {
1322+
rslt(cx, C_nil())
1323+
}
13091324
}
13101325
ty::ty_uniq(_) {
13111326
fail "free uniq unimplemented";
@@ -1341,7 +1356,11 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
13411356
let ti = none[@tydesc_info];
13421357
call_tydesc_glue_full(cx, body, tydesc,
13431358
abi::tydesc_field_drop_glue, ti);
1344-
trans_non_gc_free(cx, b)
1359+
if (!bcx_ccx(cx).sess.get_opts().do_gc) {
1360+
trans_non_gc_free(cx, b)
1361+
} else {
1362+
rslt(cx, C_nil())
1363+
}
13451364
}
13461365
ty::ty_fn(_, _, _, _, _) {
13471366
let box_cell =
@@ -1358,7 +1377,11 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
13581377
let ti = none[@tydesc_info];
13591378
call_tydesc_glue_full(cx, bindings, cx.build.Load(tydescptr),
13601379
abi::tydesc_field_drop_glue, ti);
1361-
trans_non_gc_free(cx, v)
1380+
if (!bcx_ccx(cx).sess.get_opts().do_gc) {
1381+
trans_non_gc_free(cx, v)
1382+
} else {
1383+
rslt(cx, C_nil())
1384+
}
13621385
}
13631386
_ { rslt(cx, C_nil()) }
13641387
};

0 commit comments

Comments
 (0)