Fix for #1989, #1469: when marking in CC, walk fn@ box like other boxes

This commit is contained in:
Niko Matsakis 2012-04-19 18:27:41 -07:00
parent 21f74be2c1
commit 171c89f4c5
2 changed files with 26 additions and 1 deletions

View File

@ -340,7 +340,8 @@ class mark : public shape::data<mark,shape::ptr> {
void walk_fn2(char code) { void walk_fn2(char code) {
switch (code) { switch (code) {
case shape::SHAPE_BOX_FN: { case shape::SHAPE_BOX_FN: {
shape::data<mark,shape::ptr>::walk_fn_contents1(); shape::bump_dp<void*>(dp); // skip over the code ptr
walk_box2(); // walk over the environment ptr
break; break;
} }
case shape::SHAPE_BARE_FN: // Does not close over data. case shape::SHAPE_BARE_FN: // Does not close over data.

View File

@ -0,0 +1,24 @@
// exec-env:RUST_CC_ZEAL=1
enum maybe_pointy {
none,
p(@pointy)
}
type pointy = {
mut a : maybe_pointy,
mut f : fn@()->(),
};
fn empty_pointy() -> @pointy {
ret @{
mut a : none,
mut f : fn@()->(){},
}
}
fn main()
{
let v = [empty_pointy(), empty_pointy()];
v[0].a = p(v[0]);
}