Remove resources from remaining test cases

This commit is contained in:
Tim Chevalier
2012-06-22 13:11:29 -07:00
parent 21399dca12
commit 588c1eb41f
6 changed files with 44 additions and 14 deletions

View File

@@ -7,7 +7,11 @@ use std;
export context; export context;
resource arc_destruct<T: const>(_data: int) { } class arc_destruct<T:const> {
let _data: int;
new(data: int) { self._data = data; }
drop {}
}
fn arc<T: const>(_data: T) -> arc_destruct<T> { fn arc<T: const>(_data: T) -> arc_destruct<T> {
arc_destruct(0) arc_destruct(0)

View File

@@ -3,6 +3,8 @@ export rsrc;
fn foo(_x: i32) { fn foo(_x: i32) {
} }
resource rsrc(x: i32) { class rsrc {
foo(x); let x: i32;
new(x: i32) { self.x = x; }
drop { foo(self.x); }
} }

View File

@@ -1,6 +1,5 @@
/* /*
Minimized version of core::comm (with still-local modifications Minimized version of core::comm for testing.
to turn a resource into a class) for testing.
Could probably be more minimal. Could probably be more minimal.
*/ */

View File

@@ -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<st>) { fn recurse_or_fail(depth: int, st: option<st>) {

View File

@@ -1,6 +1,10 @@
fn main() { 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())); let x = ~mut some(foo(comm::port()));
task::spawn {|move x| //! ERROR not a sendable value task::spawn {|move x| //! ERROR not a sendable value

View File

@@ -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() {} fn main() {}