Start porting tests to use classes with dtors instead of resources
This commit is contained in:
parent
8448711534
commit
7df7a9d8ac
@ -25,9 +25,13 @@ enum tg { foo, }
|
||||
enum tg { bar, }
|
||||
|
||||
#[cfg(bogus)]
|
||||
resource r(i: int) { }
|
||||
class r {
|
||||
new(i:int) {}
|
||||
}
|
||||
|
||||
resource r(i: int) { }
|
||||
class r {
|
||||
new(i:int) {}
|
||||
}
|
||||
|
||||
#[cfg(bogus)]
|
||||
mod m {
|
||||
|
@ -1,8 +1,12 @@
|
||||
// Resources can't be copied, but storing into data structures counts
|
||||
// as a move unless the stored thing is used afterwards.
|
||||
|
||||
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 test_box() {
|
||||
|
@ -1,5 +1,9 @@
|
||||
resource r(b: @mut int) {
|
||||
*b += 1;
|
||||
class r {
|
||||
let b: @mut int;
|
||||
new(b: @mut int) {
|
||||
self.b = b;
|
||||
}
|
||||
drop { *(self.b) += 1; }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,4 +1,10 @@
|
||||
resource r(i: @mut int) { *i += 1; }
|
||||
class r {
|
||||
let i: @mut int;
|
||||
new(i: @mut int) {
|
||||
self.i = i;
|
||||
}
|
||||
drop { *(self.i) += 1; }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i = @mut 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user