Add tests for out-of-stack box leak #2555
This commit is contained in:
parent
60a1497ebb
commit
b10e575217
13
src/test/run-fail/out-of-stack-managed-box.rs
Normal file
13
src/test/run-fail/out-of-stack-managed-box.rs
Normal file
@ -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
src/test/run-fail/out-of-stack-owned-box.rs
Normal file
12
src/test/run-fail/out-of-stack-owned-box.rs
Normal file
@ -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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user