mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
auto merge of #6770 : lkuper/rust/6762, r=catamorphism
This commit is contained in:
commit
7ee329e97a
24
src/test/compile-fail/issue-6762.rs
Normal file
24
src/test/compile-fail/issue-6762.rs
Normal file
@ -0,0 +1,24 @@
|
||||
//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 : &fn() -> uint)
|
||||
{
|
||||
f();
|
||||
}
|
||||
|
||||
fn main()
|
||||
{
|
||||
let x : ~uint = ~9;
|
||||
let sq : &fn() -> uint = || { *x * *x };
|
||||
|
||||
twice(x);
|
||||
invoke(sq);
|
||||
}
|
Loading…
Reference in New Issue
Block a user