about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLindsey Kuper <lindsey@composition.al>2013-05-27 15:21:45 -0400
committerLindsey Kuper <lindsey@composition.al>2013-05-27 15:21:45 -0400
commitc9c4d92889ed1b147368a31127c0aa2e4db76cd5 (patch)
tree4ff297586160f6894cd12be2e803429186650621
parent3941f78a1bfb3ecf077dd782e5d03ea7fafcad86 (diff)
downloadrust-c9c4d92889ed1b147368a31127c0aa2e4db76cd5.tar.gz
rust-c9c4d92889ed1b147368a31127c0aa2e4db76cd5.zip
Add xfail'd test for #6762.
-rw-r--r--src/test/compile-fail/issue-6762.rs24
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