From 588c1eb41ff88efe3cc971f341d6f866f66dd62c Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 22 Jun 2012 13:11:29 -0700 Subject: [PATCH] Remove resources from remaining test cases --- src/test/auxiliary/issue-2526.rs | 6 ++++- src/test/auxiliary/issue2170lib.rs | 6 +++-- src/test/auxiliary/test_comm.rs | 3 +-- src/test/bench/task-perf-alloc-unwind.rs | 5 +++- src/test/compile-fail/no-send-res-ports.rs | 8 ++++-- src/test/compile-fail/regions-in-rsrcs.rs | 30 +++++++++++++++++----- 6 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs index 9dd7d262731..700c5468e61 100644 --- a/src/test/auxiliary/issue-2526.rs +++ b/src/test/auxiliary/issue-2526.rs @@ -7,7 +7,11 @@ export context; -resource arc_destruct(_data: int) { } +class arc_destruct { + let _data: int; + new(data: int) { self._data = data; } + drop {} +} fn arc(_data: T) -> arc_destruct { arc_destruct(0) diff --git a/src/test/auxiliary/issue2170lib.rs b/src/test/auxiliary/issue2170lib.rs index 50f424594c9..915adafab66 100644 --- a/src/test/auxiliary/issue2170lib.rs +++ b/src/test/auxiliary/issue2170lib.rs @@ -3,6 +3,8 @@ fn foo(_x: i32) { } -resource rsrc(x: i32) { - foo(x); +class rsrc { + let x: i32; + new(x: i32) { self.x = x; } + drop { foo(self.x); } } \ No newline at end of file diff --git a/src/test/auxiliary/test_comm.rs b/src/test/auxiliary/test_comm.rs index 48083fdf3f4..789836c9d63 100644 --- a/src/test/auxiliary/test_comm.rs +++ b/src/test/auxiliary/test_comm.rs @@ -1,6 +1,5 @@ /* - Minimized version of core::comm (with still-local modifications - to turn a resource into a class) for testing. + Minimized version of core::comm for testing. Could probably be more minimal. */ diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 7d4fd23342b..681abed4780 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -41,7 +41,10 @@ enum st { }) } -resource r(_l: @nillist) { +class r { + let _l: @nillist; + new(l: @nillist) { self._l = l; } + drop {} } fn recurse_or_fail(depth: int, st: option) { diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 1bbb362db57..3f8fde8927e 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -1,6 +1,10 @@ fn main() { - resource foo(_x: comm::port<()>) {} - + class foo { + let _x: comm::port<()>; + new(x: comm::port<()>) { self._x = x; } + drop {} + } + let x = ~mut some(foo(comm::port())); task::spawn {|move x| //! ERROR not a sendable value diff --git a/src/test/compile-fail/regions-in-rsrcs.rs b/src/test/compile-fail/regions-in-rsrcs.rs index 1c8e6c003ed..b190491e6d6 100644 --- a/src/test/compile-fail/regions-in-rsrcs.rs +++ b/src/test/compile-fail/regions-in-rsrcs.rs @@ -1,19 +1,37 @@ -resource no0(x: &uint) { //! ERROR to use region types here, the containing type must be declared with a region bound +class no0 { + let x: &uint; + new(x: &uint) { self.x = x; } //! ERROR to use region types here, the containing type must be declared with a region bound + drop {} } -resource no1(x: &self.uint) { //! ERROR to use region types here, the containing type must be declared with a region bound +class no1 { + let x: &self.uint; + new(x: &self.uint) { self.x = x; } //! ERROR to use region types here, the containing type must be declared with a region bound + drop {} } -resource no2(x: &foo.uint) { //! ERROR named regions other than `self` are not allowed as part of a type declaration +class no2 { + let x: &foo.uint; + new(x: &foo.uint) { self.x = x; } //! ERROR named regions other than `self` are not allowed as part of a type declaration + drop {} } -resource yes0/&(x: &uint) { +class yes0/& { + let x: &uint; + new(x: &uint) { self.x = x; } + drop {} } -resource yes1/&(x: &self.uint) { +class yes1/& { + let x: &self.uint; + new(x: &self.uint) { self.x = x; } + drop {} } -resource yes2/&(x: &foo.uint) { //! ERROR named regions other than `self` are not allowed as part of a type declaration +class yes2/& { + let x: &foo.uint; + new(x: &foo.uint) { self.x = x; } //! ERROR named regions other than `self` are not allowed as part of a type declaration + drop {} } fn main() {} \ No newline at end of file -- GitLab