Skip to content

Commit aed2f38

Browse files
committed
---
yaml --- r: 6380 b: refs/heads/master c: a7573af h: refs/heads/master v: v3
1 parent 7a10412 commit aed2f38

File tree

7 files changed

+31
-74
lines changed

7 files changed

+31
-74
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 196b2b920f9094cb78cc041709b3c3456b020fbd
2+
refs/heads/master: a7573af59dceeca49f50779b7766ce8b824326fb

trunk/src/test/compile-fail/copy-res-into-tag.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

trunk/src/test/compile-fail/resource-vec-copy.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

trunk/src/test/compile-fail/unique-pinned-nocopy-3.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

trunk/src/test/run-pass/init-res-into-things.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Resources can't be copied into other types but still need to be able
2-
// to find their way into things.
1+
// Resources can't be copied, but storing into data structures counts
2+
// as a move unless the stored thing is used afterwards.
33

44
resource r(i: @mutable int) {
55
*i = *i + 1;
@@ -59,6 +59,14 @@ fn test_box_rec() {
5959
assert *i == 1;
6060
}
6161

62+
fn test_obj() {
63+
obj o(_f: r) {}
64+
let i = @mutable 0;
65+
let rr = r(i);
66+
{ let _oo = o(rr); }
67+
assert *i == 1;
68+
}
69+
6270
fn main() {
6371
test_box();
6472
test_rec();
@@ -67,4 +75,5 @@ fn main() {
6775
test_tup();
6876
test_unique();
6977
test_box_rec();
78+
test_obj();
7079
}
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
resource r(i: int) {
2-
}
1+
resource r(i: @mutable int) { *i += 1; }
32

43
fn main() {
5-
// Even though this looks like a copy, it's guaranteed not to be
6-
let a = r(0);
7-
}
4+
let i = @mutable 0;
5+
// Even though these look like copies, they are guaranteed not to be
6+
{
7+
let a = r(i);
8+
let b = (a, 10);
9+
let (c, _d) = b;
10+
log c;
11+
}
12+
assert *i == 1;
13+
}

trunk/src/test/run-pass/type-param-constraints.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@ fn u_foo<send T>(unique: T) { }
55
resource r(i: int) { }
66

77
fn main() {
8-
// FIXME: passing resources doesn't work?
9-
//p_foo(r(10));
10-
//p_foo(@r(10));
11-
// FIXME: unique boxes not yet supported.
12-
// p_foo(~r(10));
8+
p_foo(r(10));
9+
p_foo(@r(10));
10+
11+
p_foo(~r(10));
1312
p_foo(@10);
14-
// p_foo(~10);
13+
p_foo(~10);
1514
p_foo(10);
1615

17-
//s_foo(@r(10));
18-
//s_foo(~r(10));
16+
s_foo(@r(10));
1917
s_foo(@10);
20-
//s_foo(~10);
18+
s_foo(~10);
2119
s_foo(10);
2220

23-
//u_foo(~10);
21+
u_foo(~10);
2422
u_foo(10);
2523
}

0 commit comments

Comments
 (0)