From 956bc69330cef83977c6f0031fc53efc44542560 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 21 Sep 2011 10:56:28 -0700 Subject: [PATCH] Add more unwind tests for failure during construction of allocated things --- src/test/run-fail/unwind-partial-box.rs | 18 ++++++++++++++++++ src/test/run-fail/unwind-partial-vec.rs | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/test/run-fail/unwind-partial-box.rs create mode 100644 src/test/run-fail/unwind-partial-vec.rs diff --git a/src/test/run-fail/unwind-partial-box.rs b/src/test/run-fail/unwind-partial-box.rs new file mode 100644 index 000000000000..a08bb27811b2 --- /dev/null +++ b/src/test/run-fail/unwind-partial-box.rs @@ -0,0 +1,18 @@ +// error-pattern:fail + +fn f() -> [int] { fail; } + +// Voodoo. In unwind-alt we had to do this to trigger the bug. Might +// have been to do with memory allocation patterns. +fn prime() { + @0; +} + +fn partial() { + let x = @f(); +} + +fn main() { + prime(); + partial(); +} \ No newline at end of file diff --git a/src/test/run-fail/unwind-partial-vec.rs b/src/test/run-fail/unwind-partial-vec.rs new file mode 100644 index 000000000000..0e4b27cd8362 --- /dev/null +++ b/src/test/run-fail/unwind-partial-vec.rs @@ -0,0 +1,18 @@ +// error-pattern:fail + +fn f() -> [int] { fail; } + +// Voodoo. In unwind-alt we had to do this to trigger the bug. Might +// have been to do with memory allocation patterns. +fn prime() { + @0; +} + +fn partial() { + let x = [[0], f(), [0]]; +} + +fn main() { + prime(); + partial(); +} \ No newline at end of file