Skip to content

Commit 7ee329e

Browse files
committed
auto merge of #6770 : lkuper/rust/6762, r=catamorphism
2 parents fe7f528 + c9c4d92 commit 7ee329e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/test/compile-fail/issue-6762.rs

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

0 commit comments

Comments
 (0)