Skip to content

Commit def2513

Browse files
committed
---
yaml --- r: 5510 b: refs/heads/master c: 9762972 h: refs/heads/master v: v3
1 parent 788baee commit def2513

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
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: fbe00fc23650f4e6f7d7c8093c8f9dbbdb61661a
2+
refs/heads/master: 97629727b18293ae57a4c93f41a0dac8b9611cbb
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn main() {
2+
let i = ~100;
3+
let j = ~200;
4+
i <-> j;
5+
assert i == ~200;
6+
assert j == ~100;
7+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
resource r(i: @mutable int) {
2+
*i += 1;
3+
}
4+
5+
fn test1() {
6+
let i = @mutable 100;
7+
let j = @mutable 200;
8+
{
9+
let x = ~r(i);
10+
let y = ~r(j);
11+
x <-> y;
12+
assert ***x == 200;
13+
assert ***y == 100;
14+
}
15+
assert *i == 101;
16+
assert *j == 201;
17+
}
18+
19+
fn test2() {
20+
let i = @mutable 0;
21+
{
22+
let x = ~r(i);
23+
let y = ~r(i);
24+
x <-> y;
25+
}
26+
assert *i == 2;
27+
}
28+
29+
fn main() {
30+
test1();
31+
test2();
32+
}

0 commit comments

Comments
 (0)