Skip to content

Commit

Permalink
Add tests for out-of-stack box leak #2555
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Sep 22, 2012
1 parent 60a1497 commit b10e575
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/run-fail/out-of-stack-managed-box.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// NB: Not sure why this works. I expect the box argument to leak when
// we run out of stack. Maybe the box annihilator works it out?

// error-pattern:ran out of stack
fn main() {
eat(move @0);
}

fn eat(
+a: @int
) {
eat(move a)
}
12 changes: 12 additions & 0 deletions src/test/run-fail/out-of-stack-owned-box.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// xfail-test
// error-pattern:ran out of stack
fn main() {
eat(move ~0);
}

fn eat(
+a: ~int
) {
// Prevent this from being optimized to nothing
eat(move a)
}

0 comments on commit b10e575

Please sign in to comment.