Skip to content

Commit 432e931

Browse files
committed
Don't register record cleanups until the record is built
1 parent 3632629 commit 432e931

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/comp/middle/trans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3961,7 +3961,6 @@ fn trans_rec(cx: @block_ctxt, fields: [ast::field],
39613961
let rec_res = alloc_ty(bcx, t);
39623962
let rec_val = rec_res.val;
39633963
bcx = rec_res.bcx;
3964-
add_clean_temp(cx, rec_val, t);
39653964
let i: int = 0;
39663965
let base_val = C_nil();
39673966
alt base {
@@ -4000,6 +3999,7 @@ fn trans_rec(cx: @block_ctxt, fields: [ast::field],
40003999
}
40014000
i += 1;
40024001
}
4002+
add_clean_temp(cx, rec_val, t);
40034003
ret rslt(bcx, rec_val);
40044004
}
40054005

src/test/run-fail/unwind-rec.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// error-pattern:fail
2+
3+
fn build() -> [int] {
4+
fail;
5+
}
6+
7+
fn main() {
8+
let blk = {
9+
node: build()
10+
};
11+
}

0 commit comments

Comments
 (0)