Skip to content

Commit 171c89f

Browse files
committed
Fix for #1989, #1469: when marking in CC, walk fn@ box like other boxes
1 parent 21f74be commit 171c89f

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/rt/rust_cc.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ class mark : public shape::data<mark,shape::ptr> {
340340
void walk_fn2(char code) {
341341
switch (code) {
342342
case shape::SHAPE_BOX_FN: {
343-
shape::data<mark,shape::ptr>::walk_fn_contents1();
343+
shape::bump_dp<void*>(dp); // skip over the code ptr
344+
walk_box2(); // walk over the environment ptr
344345
break;
345346
}
346347
case shape::SHAPE_BARE_FN: // Does not close over data.

src/test/run-pass/issue-1989.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// exec-env:RUST_CC_ZEAL=1
2+
3+
enum maybe_pointy {
4+
none,
5+
p(@pointy)
6+
}
7+
8+
type pointy = {
9+
mut a : maybe_pointy,
10+
mut f : fn@()->(),
11+
};
12+
13+
fn empty_pointy() -> @pointy {
14+
ret @{
15+
mut a : none,
16+
mut f : fn@()->(){},
17+
}
18+
}
19+
20+
fn main()
21+
{
22+
let v = [empty_pointy(), empty_pointy()];
23+
v[0].a = p(v[0]);
24+
}

0 commit comments

Comments
 (0)