diff --git a/src/test/run-fail/morestack2.rs b/src/test/run-fail/morestack2.rs index 15123a0540df..736d0d81a5dd 100644 --- a/src/test/run-fail/morestack2.rs +++ b/src/test/run-fail/morestack2.rs @@ -20,18 +20,21 @@ fn getbig_call_c_and_fail(i: int) { } } -resource and_then_get_big_again(_i: ()) { +class and_then_get_big_again { + new() {} + drop { fn getbig(i: int) { if i != 0 { getbig(i - 1); } } getbig(10000); + } } fn main() { task::spawn {|| - let r = and_then_get_big_again(()); + let r = and_then_get_big_again(); getbig_call_c_and_fail(10000); }; } \ No newline at end of file diff --git a/src/test/run-fail/morestack3.rs b/src/test/run-fail/morestack3.rs index 223f9211307c..61b0b824d25a 100644 --- a/src/test/run-fail/morestack3.rs +++ b/src/test/run-fail/morestack3.rs @@ -5,7 +5,7 @@ use std; fn getbig_and_fail(&&i: int) { - let r = and_then_get_big_again(@0); + let _r = and_then_get_big_again(); if i != 0 { getbig_and_fail(i - 1); } else { @@ -13,13 +13,16 @@ fn getbig_and_fail(&&i: int) { } } -resource and_then_get_big_again(_i: @int) { +class and_then_get_big_again { + new() {} + drop { fn getbig(i: int) { if i != 0 { getbig(i - 1); } } getbig(100); + } } fn main() { diff --git a/src/test/run-fail/morestack4.rs b/src/test/run-fail/morestack4.rs index 8f0ccec560f7..63155b50de15 100644 --- a/src/test/run-fail/morestack4.rs +++ b/src/test/run-fail/morestack4.rs @@ -5,7 +5,7 @@ use std; fn getbig_and_fail(&&i: int) { - let r = and_then_get_big_again(@0); + let r = and_then_get_big_again(); if i != 0 { getbig_and_fail(i - 1); } else { @@ -13,7 +13,9 @@ fn getbig_and_fail(&&i: int) { } } -resource and_then_get_big_again(_i: @int) { +class and_then_get_big_again { + new() {} + drop {} } fn main() { diff --git a/src/test/run-fail/rt-set-exit-status-fail2.rs b/src/test/run-fail/rt-set-exit-status-fail2.rs index 8b685b7c712f..680df73d62e4 100644 --- a/src/test/run-fail/rt-set-exit-status-fail2.rs +++ b/src/test/run-fail/rt-set-exit-status-fail2.rs @@ -1,15 +1,19 @@ // error-pattern:whatever +class r { + // Setting the exit status after the runtime has already + // failed has no effect and the process exits with the + // runtime's exit code + drop { + os::set_exit_status(50); + } + new() {} +} + fn main() { log(error, "whatever"); task::spawn {|| - resource r(_i: ()) { - // Setting the exit status after the runtime has already - // failed has no effect and the process exits with the - // runtime's exit code - os::set_exit_status(50); - } - let i = r(()); + let i = r(); }; fail; } \ No newline at end of file diff --git a/src/test/run-fail/too-much-recursion-unwinding.rs b/src/test/run-fail/too-much-recursion-unwinding.rs index e56361e2f72f..b483a5eb10a5 100644 --- a/src/test/run-fail/too-much-recursion-unwinding.rs +++ b/src/test/run-fail/too-much-recursion-unwinding.rs @@ -9,11 +9,15 @@ fn recurse() { recurse(); } -resource r(recursed: *mut bool) unsafe { +class r { + let recursed: *mut bool; + new(recursed: *mut bool) unsafe { self.recursed = recursed; } + drop unsafe { if !*recursed { *recursed = true; recurse(); } + } } fn main() { diff --git a/src/test/run-fail/unwind-box-res.rs b/src/test/run-fail/unwind-box-res.rs index e076f8910316..8b771dc7651a 100644 --- a/src/test/run-fail/unwind-box-res.rs +++ b/src/test/run-fail/unwind-box-res.rs @@ -4,8 +4,12 @@ fn failfn() { fail; } -resource r(v: *int) unsafe { - let v2: ~int = unsafe::reinterpret_cast(v); +class r { + let v: *int; + new(v: *int) { self.v = v; } + drop unsafe { + let _v2: ~int = unsafe::reinterpret_cast(self.v); + } } fn main() unsafe { diff --git a/src/test/run-fail/unwind-resource-fail.rs b/src/test/run-fail/unwind-resource-fail.rs index 4ab8dc950850..9e24c1598c6a 100644 --- a/src/test/run-fail/unwind-resource-fail.rs +++ b/src/test/run-fail/unwind-resource-fail.rs @@ -1,9 +1,9 @@ // error-pattern:fail // xfail-test -resource r(i: int) { - // What happens when destructors throw? - fail; +class r { + new(i:int) {} + drop { fail; } } fn main() { diff --git a/src/test/run-fail/unwind-resource-fail2.rs b/src/test/run-fail/unwind-resource-fail2.rs index 5c90bc6b4ed7..a29f83bf49a7 100644 --- a/src/test/run-fail/unwind-resource-fail2.rs +++ b/src/test/run-fail/unwind-resource-fail2.rs @@ -1,9 +1,9 @@ // error-pattern:fail // xfail-test -resource r(i: int) { - // Double-fail!! - fail; +class r { + new(i:int) {} + drop { fail; } } fn main() { diff --git a/src/test/run-fail/unwind-resource-fail3.rs b/src/test/run-fail/unwind-resource-fail3.rs index 834c3ff78211..c7eeec2e5480 100644 --- a/src/test/run-fail/unwind-resource-fail3.rs +++ b/src/test/run-fail/unwind-resource-fail3.rs @@ -1,9 +1,11 @@ // error-pattern:quux // xfail-test -resource faily_box(_i: @int) { - // What happens to the box pointer owned by this resource? - fail "quux"; +class faily_box { + let i: @int; + new(i: @int) { self.i = i; } + // What happens to the box pointer owned by this class? + drop { fail "quux"; } } fn main() {