blob: 22bb660a080666160761e4c61c79c5cb9b8aee82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
//xfail-test
// Creating a stack closure which references an owned pointer and then
// transferring ownership of the owned box before invoking the stack
// closure results in a crash.
fn twice(x: ~uint) -> uint {
*x * 2
}
fn invoke(f: || -> uint) {
f();
}
fn main() {
let x : ~uint = ~9;
let sq : || -> uint = || { *x * *x };
twice(x);
invoke(sq);
}
|