Skip to content

Commit 026f3dc

Browse files
committed
---
yaml --- r: 16089 b: refs/heads/try c: 5e35d49 h: refs/heads/master i: 16087: 74fa67c v: v3
1 parent b96c2b1 commit 026f3dc

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: aa2efc05ea9aae3016890d61793768952b81154e
5+
refs/heads/try: 5e35d49a5097d1a67dc1d99c367447a69c57d0bf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libstd/arc.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,34 @@ fn get_arc<T: send const>(c: comm::chan<proto<T>>) -> arc::arc<T> {
106106
c.send(shared_get(chan(p)));
107107
p.recv()
108108
}
109+
110+
#[cfg(test)]
111+
mod tests {
112+
import comm::*;
113+
114+
#[test]
115+
fn manually_share_arc() {
116+
let v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
117+
let arc_v = arc::arc(v);
118+
119+
let p = port();
120+
let c = chan(p);
121+
122+
task::spawn() {||
123+
let p = port();
124+
c.send(chan(p));
125+
126+
let arc_v = p.recv();
127+
128+
let v = *arc::get::<[int]>(&arc_v);
129+
assert v[3] == 4;
130+
};
131+
132+
let c = p.recv();
133+
c.send(arc::clone(&arc_v));
134+
135+
assert (*arc::get(&arc_v))[2] == 3;
136+
137+
log(info, arc_v);
138+
}
139+
}

branches/try/src/test/run-pass/share-arc.rs

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

0 commit comments

Comments
 (0)