diff options
| author | bors <bors@rust-lang.org> | 2013-05-28 01:50:03 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-28 01:50:03 -0700 |
| commit | 7ee329e97a24d259f76c1a6e910f32aa11e07862 (patch) | |
| tree | b348aca527425efeb36365921dffaf9a7ed3ad96 | |
| parent | fe7f528e5d537adab4c9c87dbbabbd0382869516 (diff) | |
| parent | c9c4d92889ed1b147368a31127c0aa2e4db76cd5 (diff) | |
| download | rust-7ee329e97a24d259f76c1a6e910f32aa11e07862.tar.gz rust-7ee329e97a24d259f76c1a6e910f32aa11e07862.zip | |
auto merge of #6770 : lkuper/rust/6762, r=catamorphism
| -rw-r--r-- | src/test/compile-fail/issue-6762.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-6762.rs b/src/test/compile-fail/issue-6762.rs new file mode 100644 index 00000000000..391c1019a94 --- /dev/null +++ b/src/test/compile-fail/issue-6762.rs @@ -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); +} \ No newline at end of file |
