diff --git a/src/test/compile-fail/issue-2063-resource.rs b/src/test/compile-fail/issue-2063-resource.rs index 821365f43ac0..0fb4f2caf6c9 100644 --- a/src/test/compile-fail/issue-2063-resource.rs +++ b/src/test/compile-fail/issue-2063-resource.rs @@ -1,12 +1,12 @@ // test that autoderef of a type like this does not // cause compiler to loop. Note that no instances // of such a type could ever be constructed. -resource t(x: x) {} //! ERROR this type cannot be instantiated -enum x = @t; //! ERROR this type cannot be instantiated - -fn new_t(x: t) { - x.to_str; //! ERROR attempted access of field to_str +class t { //! ERROR this type cannot be instantiated + let x: x; + let to_str: (); + new(x: x) { self.x = x; self.to_str = (); } } +enum x = @t; //! ERROR this type cannot be instantiated fn main() { } diff --git a/src/test/compile-fail/non-const.rs b/src/test/compile-fail/non-const.rs index 320bc1d25f84..c438a5bafba5 100644 --- a/src/test/compile-fail/non-const.rs +++ b/src/test/compile-fail/non-const.rs @@ -2,8 +2,17 @@ fn foo(_x: T) { } -resource r(_x: int) {} -resource r2(_x: @mut int) {} +class r { + let x:int; + new(x:int) { self.x = x; } + drop {} +} + +class r2 { + let x:@mut int; + new(x:@mut int) { self.x = x; } + drop {} +} fn main() { foo({f: 3}); diff --git a/src/test/compile-fail/pinned-deep-copy.rs b/src/test/compile-fail/pinned-deep-copy.rs index 1a07b3f1de0e..496a4fcbe76e 100644 --- a/src/test/compile-fail/pinned-deep-copy.rs +++ b/src/test/compile-fail/pinned-deep-copy.rs @@ -1,7 +1,9 @@ // error-pattern: copying a noncopyable value -resource r(i: @mut int) { - *i = *i + 1; +class r { + let i: @mut int; + new(i: @mut int) { self.i = i; } + drop { *(self.i) = *(self.i) + 1; } } fn main() { diff --git a/src/test/compile-fail/record-with-resource.rs b/src/test/compile-fail/record-with-resource.rs index 6cdaafb22a57..69f0cf09726e 100644 --- a/src/test/compile-fail/record-with-resource.rs +++ b/src/test/compile-fail/record-with-resource.rs @@ -1,7 +1,9 @@ // error-pattern: copying a noncopyable value -resource my_resource(x: int) { - log(error, x); +class my_resource { + let x: int; + new(x: int) { self.x = x; } + drop { log(error, self.x); } } fn main() { diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs index 6f9c547d6322..1582c8a049fc 100644 --- a/src/test/compile-fail/regions-bounds.rs +++ b/src/test/compile-fail/regions-bounds.rs @@ -5,7 +5,6 @@ enum an_enum/& { } iface an_iface/& { } class a_class/& { new() { } } -resource a_rsrc/&(_x: ()) { } fn a_fn1(e: an_enum/&a) -> an_enum/&b { ret e; //! ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a` @@ -19,11 +18,7 @@ fn a_fn3(e: a_class/&a) -> a_class/&b { ret e; //! ERROR mismatched types: expected `a_class/&b` but found `a_class/&a` } -fn a_fn4(e: a_rsrc/&a) -> a_rsrc/&b { - ret e; //! ERROR mismatched types: expected `a_rsrc/&b` but found `a_rsrc/&a` -} - -fn a_fn5(e: int/&a) -> int/&b { +fn a_fn4(e: int/&a) -> int/&b { //!^ ERROR Region parameters are not allowed on this type. //!^^ ERROR Region parameters are not allowed on this type. ret e; diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/compile-fail/unique-pinned-nocopy.rs index 97e4515d98d3..75250d9faf6c 100644 --- a/src/test/compile-fail/unique-pinned-nocopy.rs +++ b/src/test/compile-fail/unique-pinned-nocopy.rs @@ -1,6 +1,9 @@ // error-pattern: copying a noncopyable value -resource r(b: bool) { +class r { + let b:bool; + new(b: bool) { self.b = b; } + drop {} } fn main() { diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 045a22fa8e03..92dcd538aa7f 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -1,7 +1,9 @@ // error-pattern: copying a noncopyable value -resource r(i: @mut int) { - *i = *i + 1; +class r { + let i: @mut int; + new(i: @mut int) { self.i = i; } + drop { *(self.i) = *(self.i) + 1; } } fn f(+i: [T], +j: [T]) { diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/compile-fail/vec-res-add.rs index ce1aae2fa8a2..ea411ca27a2f 100644 --- a/src/test/compile-fail/vec-res-add.rs +++ b/src/test/compile-fail/vec-res-add.rs @@ -1,9 +1,12 @@ // error-pattern: copying a noncopyable value -resource r(_i: int) { } +class r { + new(_i:int) {} + drop {} +} fn main() { - // This can't make sense as it would copy the resources + // This can't make sense as it would copy the classes let i <- [r(0)]; let j <- [r(1)]; let k = i + j;