Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
178882c9
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
178882c9
编写于
2月 15, 2013
作者:
L
Luqman Aden
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tests/tutorials: Get rid of `move`.
上级
e244f103
变更
150
展开全部
隐藏空白更改
内联
并排
Showing
150 changed file
with
409 addition
and
411 deletion
+409
-411
doc/rust.md
doc/rust.md
+1
-1
doc/tutorial-borrowed-ptr.md
doc/tutorial-borrowed-ptr.md
+1
-1
doc/tutorial-tasks.md
doc/tutorial-tasks.md
+10
-10
doc/tutorial.md
doc/tutorial.md
+1
-1
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+1
-1
src/test/auxiliary/cci_class_6.rs
src/test/auxiliary/cci_class_6.rs
+1
-1
src/test/bench/core-vec-append.rs
src/test/bench/core-vec-append.rs
+1
-1
src/test/bench/graph500-bfs.rs
src/test/bench/graph500-bfs.rs
+2
-2
src/test/bench/msgsend-pipes-shared.rs
src/test/bench/msgsend-pipes-shared.rs
+5
-5
src/test/bench/msgsend-pipes.rs
src/test/bench/msgsend-pipes.rs
+6
-6
src/test/bench/msgsend-ring-mutex-arcs.rs
src/test/bench/msgsend-ring-mutex-arcs.rs
+14
-14
src/test/bench/msgsend-ring-pipes.rs
src/test/bench/msgsend-ring-pipes.rs
+14
-15
src/test/bench/msgsend-ring-rw-arcs.rs
src/test/bench/msgsend-ring-rw-arcs.rs
+13
-14
src/test/bench/noise.rs
src/test/bench/noise.rs
+2
-2
src/test/bench/pingpong.rs
src/test/bench/pingpong.rs
+22
-22
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-chameneos-redux.rs
+1
-1
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
+6
-6
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-mandelbrot.rs
+1
-1
src/test/bench/shootout-pfib.rs
src/test/bench/shootout-pfib.rs
+4
-4
src/test/bench/task-perf-alloc-unwind.rs
src/test/bench/task-perf-alloc-unwind.rs
+1
-1
src/test/bench/task-perf-jargon-metal-smoke.rs
src/test/bench/task-perf-jargon-metal-smoke.rs
+4
-4
src/test/bench/task-perf-linked-failure.rs
src/test/bench/task-perf-linked-failure.rs
+2
-2
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs
...nd-by-move-neither-can-live-while-the-other-survives-1.rs
+2
-2
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs
...nd-by-move-neither-can-live-while-the-other-survives-2.rs
+2
-2
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs
...nd-by-move-neither-can-live-while-the-other-survives-3.rs
+2
-2
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs
...nd-by-move-neither-can-live-while-the-other-survives-4.rs
+2
-2
src/test/compile-fail/bind-by-move-no-guards.rs
src/test/compile-fail/bind-by-move-no-guards.rs
+3
-3
src/test/compile-fail/bind-by-move-no-lvalues-1.rs
src/test/compile-fail/bind-by-move-no-lvalues-1.rs
+1
-1
src/test/compile-fail/bind-by-move-no-lvalues-2.rs
src/test/compile-fail/bind-by-move-no-lvalues-2.rs
+1
-1
src/test/compile-fail/bind-by-move-no-sub-bindings.rs
src/test/compile-fail/bind-by-move-no-sub-bindings.rs
+2
-2
src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
+1
-1
src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs
src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs
+1
-1
src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
+1
-1
src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
...st/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
+1
-1
src/test/compile-fail/copy-a-resource.rs
src/test/compile-fail/copy-a-resource.rs
+1
-1
src/test/compile-fail/issue-2548.rs
src/test/compile-fail/issue-2548.rs
+1
-1
src/test/compile-fail/issue-3177-mutable-struct.rs
src/test/compile-fail/issue-3177-mutable-struct.rs
+1
-1
src/test/compile-fail/kindck-nonsendable-1.rs
src/test/compile-fail/kindck-nonsendable-1.rs
+1
-1
src/test/compile-fail/liveness-unused.rs
src/test/compile-fail/liveness-unused.rs
+1
-1
src/test/compile-fail/noncopyable-class.rs
src/test/compile-fail/noncopyable-class.rs
+1
-1
src/test/compile-fail/unique-pinned-nocopy.rs
src/test/compile-fail/unique-pinned-nocopy.rs
+1
-1
src/test/compile-fail/unique-unique-kind.rs
src/test/compile-fail/unique-unique-kind.rs
+1
-1
src/test/compile-fail/unique-vec-res.rs
src/test/compile-fail/unique-vec-res.rs
+2
-2
src/test/compile-fail/unsendable-class.rs
src/test/compile-fail/unsendable-class.rs
+1
-1
src/test/compile-fail/vec-res-add.rs
src/test/compile-fail/vec-res-add.rs
+2
-2
src/test/run-fail/out-of-stack-managed-box.rs
src/test/run-fail/out-of-stack-managed-box.rs
+2
-2
src/test/run-fail/out-of-stack-owned-box.rs
src/test/run-fail/out-of-stack-owned-box.rs
+2
-2
src/test/run-fail/unwind-box-res.rs
src/test/run-fail/unwind-box-res.rs
+1
-1
src/test/run-fail/unwind-closure.rs
src/test/run-fail/unwind-closure.rs
+1
-1
src/test/run-fail/unwind-move.rs
src/test/run-fail/unwind-move.rs
+1
-1
src/test/run-fail/unwind-resource-fail.rs
src/test/run-fail/unwind-resource-fail.rs
+1
-1
src/test/run-fail/unwind-resource-fail2.rs
src/test/run-fail/unwind-resource-fail2.rs
+1
-1
src/test/run-pass/alt-ref-binding-in-guard-3256.rs
src/test/run-pass/alt-ref-binding-in-guard-3256.rs
+1
-1
src/test/run-pass/argument-passing.rs
src/test/run-pass/argument-passing.rs
+1
-1
src/test/run-pass/auto-encode.rs
src/test/run-pass/auto-encode.rs
+1
-1
src/test/run-pass/auto-ref-sliceable.rs
src/test/run-pass/auto-ref-sliceable.rs
+1
-1
src/test/run-pass/bind-by-move.rs
src/test/run-pass/bind-by-move.rs
+2
-2
src/test/run-pass/borrowck-move-from-unsafe-ptr-ok.rs
src/test/run-pass/borrowck-move-from-unsafe-ptr-ok.rs
+1
-1
src/test/run-pass/cap-clause-move.rs
src/test/run-pass/cap-clause-move.rs
+4
-4
src/test/run-pass/class-poly-methods.rs
src/test/run-pass/class-poly-methods.rs
+1
-1
src/test/run-pass/dvec-test.rs
src/test/run-pass/dvec-test.rs
+1
-1
src/test/run-pass/fn-bare-spawn.rs
src/test/run-pass/fn-bare-spawn.rs
+1
-1
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/hashmap-memory.rs
+1
-1
src/test/run-pass/init-res-into-things.rs
src/test/run-pass/init-res-into-things.rs
+6
-6
src/test/run-pass/intrinsic-move-val.rs
src/test/run-pass/intrinsic-move-val.rs
+1
-1
src/test/run-pass/issue-1895.rs
src/test/run-pass/issue-1895.rs
+1
-1
src/test/run-pass/issue-2185.rs
src/test/run-pass/issue-2185.rs
+3
-3
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2718.rs
+33
-33
src/test/run-pass/issue-2834.rs
src/test/run-pass/issue-2834.rs
+1
-1
src/test/run-pass/issue-2904.rs
src/test/run-pass/issue-2904.rs
+1
-1
src/test/run-pass/issue-2930.rs
src/test/run-pass/issue-2930.rs
+1
-1
src/test/run-pass/issue-3168.rs
src/test/run-pass/issue-3168.rs
+3
-3
src/test/run-pass/issue-3176.rs
src/test/run-pass/issue-3176.rs
+4
-4
src/test/run-pass/issue-3220.rs
src/test/run-pass/issue-3220.rs
+1
-1
src/test/run-pass/issue-3447.rs
src/test/run-pass/issue-3447.rs
+1
-1
src/test/run-pass/issue-3878.rs
src/test/run-pass/issue-3878.rs
+1
-1
src/test/run-pass/issue-4016.rs
src/test/run-pass/issue-4016.rs
+1
-1
src/test/run-pass/last-use-in-block.rs
src/test/run-pass/last-use-in-block.rs
+2
-2
src/test/run-pass/last-use-in-cap-clause.rs
src/test/run-pass/last-use-in-cap-clause.rs
+1
-1
src/test/run-pass/liveness-move-in-loop.rs
src/test/run-pass/liveness-move-in-loop.rs
+1
-1
src/test/run-pass/log-linearized.rs
src/test/run-pass/log-linearized.rs
+1
-1
src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs
...est/run-pass/monomorphized-callees-with-ty-params-3314.rs
+1
-1
src/test/run-pass/move-1-unique.rs
src/test/run-pass/move-1-unique.rs
+1
-1
src/test/run-pass/move-1.rs
src/test/run-pass/move-1.rs
+1
-1
src/test/run-pass/move-2-unique.rs
src/test/run-pass/move-2-unique.rs
+1
-1
src/test/run-pass/move-2.rs
src/test/run-pass/move-2.rs
+1
-1
src/test/run-pass/move-3-unique.rs
src/test/run-pass/move-3-unique.rs
+1
-1
src/test/run-pass/move-3.rs
src/test/run-pass/move-3.rs
+1
-1
src/test/run-pass/move-4-unique.rs
src/test/run-pass/move-4-unique.rs
+3
-3
src/test/run-pass/move-4.rs
src/test/run-pass/move-4.rs
+3
-3
src/test/run-pass/move-arg-2-unique.rs
src/test/run-pass/move-arg-2-unique.rs
+1
-1
src/test/run-pass/move-arg-2.rs
src/test/run-pass/move-arg-2.rs
+1
-1
src/test/run-pass/move-arg.rs
src/test/run-pass/move-arg.rs
+1
-1
src/test/run-pass/move-nullary-fn.rs
src/test/run-pass/move-nullary-fn.rs
+1
-1
src/test/run-pass/move-scalar.rs
src/test/run-pass/move-scalar.rs
+1
-1
src/test/run-pass/move-self.rs
src/test/run-pass/move-self.rs
+1
-1
src/test/run-pass/non-legacy-modes.rs
src/test/run-pass/non-legacy-modes.rs
+1
-1
src/test/run-pass/option-unwrap.rs
src/test/run-pass/option-unwrap.rs
+3
-3
src/test/run-pass/pipe-bank-proto.rs
src/test/run-pass/pipe-bank-proto.rs
+15
-15
src/test/run-pass/pipe-detect-term.rs
src/test/run-pass/pipe-detect-term.rs
+3
-3
src/test/run-pass/pipe-peek.rs
src/test/run-pass/pipe-peek.rs
+1
-1
src/test/run-pass/pipe-pingpong-bounded.rs
src/test/run-pass/pipe-pingpong-bounded.rs
+17
-17
src/test/run-pass/pipe-pingpong-proto.rs
src/test/run-pass/pipe-pingpong-proto.rs
+10
-10
src/test/run-pass/pipe-presentation-examples.rs
src/test/run-pass/pipe-presentation-examples.rs
+13
-13
src/test/run-pass/pipe-select.rs
src/test/run-pass/pipe-select.rs
+16
-16
src/test/run-pass/pipe-sleep.rs
src/test/run-pass/pipe-sleep.rs
+2
-2
src/test/run-pass/regions-copy-closure.rs
src/test/run-pass/regions-copy-closure.rs
+1
-1
src/test/run-pass/regions-static-closure.rs
src/test/run-pass/regions-static-closure.rs
+2
-2
src/test/run-pass/resource-assign-is-not-copy.rs
src/test/run-pass/resource-assign-is-not-copy.rs
+2
-2
src/test/run-pass/resource-cycle.rs
src/test/run-pass/resource-cycle.rs
+4
-4
src/test/run-pass/resource-cycle2.rs
src/test/run-pass/resource-cycle2.rs
+2
-2
src/test/run-pass/resource-cycle3.rs
src/test/run-pass/resource-cycle3.rs
+2
-2
src/test/run-pass/resource-destruct.rs
src/test/run-pass/resource-destruct.rs
+1
-1
src/test/run-pass/resource-generic.rs
src/test/run-pass/resource-generic.rs
+1
-1
src/test/run-pass/rt-sched-1.rs
src/test/run-pass/rt-sched-1.rs
+1
-1
src/test/run-pass/select-macro.rs
src/test/run-pass/select-macro.rs
+8
-8
src/test/run-pass/sendfn-spawn-with-fn-arg.rs
src/test/run-pass/sendfn-spawn-with-fn-arg.rs
+1
-1
src/test/run-pass/static-method-test.rs
src/test/run-pass/static-method-test.rs
+2
-2
src/test/run-pass/task-comm-0.rs
src/test/run-pass/task-comm-0.rs
+1
-1
src/test/run-pass/task-comm-10.rs
src/test/run-pass/task-comm-10.rs
+3
-3
src/test/run-pass/task-comm-11.rs
src/test/run-pass/task-comm-11.rs
+2
-2
src/test/run-pass/task-comm-12.rs
src/test/run-pass/task-comm-12.rs
+2
-2
src/test/run-pass/task-comm-13.rs
src/test/run-pass/task-comm-13.rs
+1
-1
src/test/run-pass/task-comm-14.rs
src/test/run-pass/task-comm-14.rs
+2
-2
src/test/run-pass/task-comm-15.rs
src/test/run-pass/task-comm-15.rs
+1
-1
src/test/run-pass/task-comm-16.rs
src/test/run-pass/task-comm-16.rs
+1
-1
src/test/run-pass/task-comm-3.rs
src/test/run-pass/task-comm-3.rs
+2
-2
src/test/run-pass/task-comm-7.rs
src/test/run-pass/task-comm-7.rs
+4
-4
src/test/run-pass/task-comm-9.rs
src/test/run-pass/task-comm-9.rs
+3
-3
src/test/run-pass/trait-default-method-bound-subst.rs
src/test/run-pass/trait-default-method-bound-subst.rs
+2
-2
src/test/run-pass/trait-default-method-bound-subst2.rs
src/test/run-pass/trait-default-method-bound-subst2.rs
+2
-2
src/test/run-pass/trait-default-method-bound-subst3.rs
src/test/run-pass/trait-default-method-bound-subst3.rs
+2
-2
src/test/run-pass/trait-default-method-bound-subst4.rs
src/test/run-pass/trait-default-method-bound-subst4.rs
+2
-2
src/test/run-pass/trait-to-str.rs
src/test/run-pass/trait-to-str.rs
+1
-1
src/test/run-pass/unique-decl-move-temp.rs
src/test/run-pass/unique-decl-move-temp.rs
+1
-1
src/test/run-pass/unique-decl-move.rs
src/test/run-pass/unique-decl-move.rs
+1
-1
src/test/run-pass/unique-fn-arg-move.rs
src/test/run-pass/unique-fn-arg-move.rs
+1
-1
src/test/run-pass/unique-move-drop.rs
src/test/run-pass/unique-move-drop.rs
+1
-1
src/test/run-pass/unique-move-temp.rs
src/test/run-pass/unique-move-temp.rs
+1
-1
src/test/run-pass/unique-move.rs
src/test/run-pass/unique-move.rs
+1
-1
src/test/run-pass/unreachable-code-1.rs
src/test/run-pass/unreachable-code-1.rs
+1
-1
src/test/run-pass/unreachable-code.rs
src/test/run-pass/unreachable-code.rs
+1
-1
src/test/run-pass/unused-move-capture.rs
src/test/run-pass/unused-move-capture.rs
+1
-1
src/test/run-pass/unused-move.rs
src/test/run-pass/unused-move.rs
+1
-1
src/test/run-pass/unwind-resource.rs
src/test/run-pass/unwind-resource.rs
+1
-1
src/test/run-pass/unwind-resource2.rs
src/test/run-pass/unwind-resource2.rs
+1
-1
src/test/run-pass/weird-exprs.rs
src/test/run-pass/weird-exprs.rs
+2
-2
src/test/run-pass/while-loop-constraints-2.rs
src/test/run-pass/while-loop-constraints-2.rs
+1
-1
src/test/run-pass/yield.rs
src/test/run-pass/yield.rs
+2
-2
src/test/run-pass/yield1.rs
src/test/run-pass/yield1.rs
+2
-2
未找到文件。
doc/rust.md
浏览文件 @
178882c9
...
...
@@ -213,7 +213,7 @@ else enum extern
false fn for
if impl
let log loop
match mod m
ove m
ut
match mod mut
priv pub pure
ref return
self static struct super
...
...
doc/tutorial-borrowed-ptr.md
浏览文件 @
178882c9
...
...
@@ -431,7 +431,7 @@ fn example5c(x: @S) -> int {
let y = &v.g;
...
}
x.f =
move
v; // Replace x.f
x.f = v; // Replace x.f
...
# return 0;
}
...
...
doc/tutorial-tasks.md
浏览文件 @
178882c9
...
...
@@ -161,7 +161,7 @@ use pipes::{stream, Port, Chan};
let (port, chan): (Port<int>, Chan<int>) = stream();
do spawn |
move chan
| {
do spawn || {
let result = some_expensive_computation();
chan.send(result);
}
...
...
@@ -192,7 +192,7 @@ spawns the child task.
# use pipes::{stream, Port, Chan};
# fn some_expensive_computation() -> int { 42 }
# let (port, chan) = stream();
do spawn |
move chan
| {
do spawn || {
let result = some_expensive_computation();
chan.send(result);
}
...
...
@@ -229,7 +229,7 @@ following program is ill-typed:
# fn some_expensive_computation() -> int { 42 }
let (port, chan) = stream();
do spawn
|move chan|
{
do spawn {
chan.send(some_expensive_computation());
}
...
...
@@ -248,12 +248,12 @@ Instead we can use a `SharedChan`, a type that allows a single
use pipes::{stream, SharedChan};
let (port, chan) = stream();
let chan = SharedChan(
move
chan);
let chan = SharedChan(chan);
for uint::range(0, 3) |init_val| {
// Create a new channel handle to distribute to the child task
let child_chan = chan.clone();
do spawn
|move child_chan|
{
do spawn {
child_chan.send(some_expensive_computation(init_val));
}
}
...
...
@@ -283,10 +283,10 @@ might look like the example below.
// Create a vector of ports, one for each child task
let ports = do vec::from_fn(3) |init_val| {
let (port, chan) = stream();
do spawn
|move chan|
{
do spawn {
chan.send(some_expensive_computation(init_val));
}
move
port
port
};
// Wait on each port, accumulating the results
...
...
@@ -398,13 +398,13 @@ before returning. Hence:
# fn sleep_forever() { loop { task::yield() } }
# do task::try {
let (receiver, sender): (Port<int>, Chan<int>) = stream();
do spawn
|move receiver|
{ // Bidirectionally linked
do spawn { // Bidirectionally linked
// Wait for the supervised child task to exist.
let message = receiver.recv();
// Kill both it and the parent task.
assert message != 42;
}
do try
|move sender|
{ // Unidirectionally linked
do try { // Unidirectionally linked
sender.send(42);
sleep_forever(); // Will get woken up by force
}
...
...
@@ -505,7 +505,7 @@ Here is the code for the parent task:
let (from_child, to_child) = DuplexStream();
do spawn
|move to_child|
{
do spawn {
stringifier(&to_child);
};
...
...
doc/tutorial.md
浏览文件 @
178882c9
...
...
@@ -1260,7 +1260,7 @@ Moving it into a mutable slot makes the elements assignable.
let crayons: ~[Crayon] = ~[BananaMania, Beaver, Bittersweet];
// Put the vector into a mutable slot
let mut mutable_crayons =
move
crayons;
let mut mutable_crayons = crayons;
// Now it's mutable to the bone
mutable_crayons[0] = Apricot;
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
178882c9
...
...
@@ -1229,7 +1229,7 @@ pub fn encode_metadata(parms: encode_parms, crate: &crate) -> ~[u8] {
let
ecx
:
@
encode_ctxt
=
@
encode_ctxt
({
diag
:
parms
.diag
,
tcx
:
parms
.tcx
,
stats
:
@
mut
move
stats
,
stats
:
@
mut
stats
,
reachable
:
parms
.reachable
,
reexports2
:
parms
.reexports2
,
item_symbols
:
parms
.item_symbols
,
...
...
src/test/auxiliary/cci_class_6.rs
浏览文件 @
178882c9
...
...
@@ -27,7 +27,7 @@ pub fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {
cat
{
meows
:
in_x
,
how_hungry
:
in_y
,
info
:
move
in_info
info
:
in_info
}
}
}
...
...
src/test/bench/core-vec-append.rs
浏览文件 @
178882c9
...
...
@@ -27,7 +27,7 @@ fn collect_dvec(num: uint) -> ~[uint] {
for
uint
::
range
(
0u
,
num
)
|
i
|
{
result
.push
(
i
);
}
return
dvec
::
unwrap
(
move
result
);
return
dvec
::
unwrap
(
result
);
}
fn
main
()
{
...
...
src/test/bench/graph500-bfs.rs
浏览文件 @
178882c9
...
...
@@ -141,7 +141,7 @@ fn bfs(graph: graph, key: node_id) -> bfs_result {
};
}
m
ove
m
arks
marks
}
/**
...
...
@@ -260,7 +260,7 @@ fn is_gray_factory() -> ~fn(c: &color) -> bool {
i
+=
1
;
let
old_len
=
colors
.len
();
let
color
=
arc
::
ARC
(
move
colors
);
let
color
=
arc
::
ARC
(
colors
);
let
color_vec
=
arc
::
get
(
&
color
);
// FIXME #3387 requires this temp
colors
=
do
par
::
mapi
(
*
color_vec
)
{
...
...
src/test/bench/msgsend-pipes-shared.rs
浏览文件 @
178882c9
...
...
@@ -27,7 +27,7 @@
use
pipes
::{
Port
,
Chan
,
SharedChan
};
macro_rules!
move_out
(
{
$x:expr
}
=>
{
unsafe
{
let
y
=
move
*
ptr
::
addr_of
(
&
(
$x
));
move
y
}
}
{
$x:expr
}
=>
{
unsafe
{
let
y
=
*
ptr
::
addr_of
(
&
(
$x
));
y
}
}
)
enum
request
{
...
...
@@ -58,7 +58,7 @@ fn run(args: &[~str]) {
let
(
from_child
,
to_parent
)
=
pipes
::
stream
();
let
(
from_parent
,
to_child
)
=
pipes
::
stream
();
let
to_child
=
SharedChan
(
move
to_child
);
let
to_child
=
SharedChan
(
to_child
);
let
size
=
uint
::
from_str
(
args
[
1
])
.get
();
let
workers
=
uint
::
from_str
(
args
[
2
])
.get
();
...
...
@@ -68,8 +68,8 @@ fn run(args: &[~str]) {
for
uint
::
range
(
0
,
workers
)
|
_
i
|
{
let
to_child
=
to_child
.clone
();
do
task
::
task
()
.future_result
(|
+
r
|
{
worker_results
.push
(
move
r
);
})
.spawn
|
move
to_child
|
{
worker_results
.push
(
r
);
})
.spawn
||
{
for
uint
::
range
(
0
,
size
/
workers
)
|
_
i
|
{
//error!("worker %?: sending %? bytes", i, num_bytes);
to_child
.send
(
bytes
(
num_bytes
));
...
...
@@ -77,7 +77,7 @@ fn run(args: &[~str]) {
//error!("worker %? exiting", i);
};
}
do
task
::
spawn
|
move
from_parent
,
move
to_parent
|
{
do
task
::
spawn
||
{
server
(
from_parent
,
to_parent
);
}
...
...
src/test/bench/msgsend-pipes.rs
浏览文件 @
178882c9
...
...
@@ -23,7 +23,7 @@
use
pipes
::{
Port
,
PortSet
,
Chan
};
macro_rules!
move_out
(
{
$x:expr
}
=>
{
unsafe
{
let
y
=
move
*
ptr
::
addr_of
(
&
(
$x
));
move
y
}
}
{
$x:expr
}
=>
{
unsafe
{
let
y
=
*
ptr
::
addr_of
(
&
(
$x
));
y
}
}
)
enum
request
{
...
...
@@ -54,7 +54,7 @@ fn run(args: &[~str]) {
let
(
from_child
,
to_parent
)
=
pipes
::
stream
();
let
(
from_parent_
,
to_child
)
=
pipes
::
stream
();
let
from_parent
=
PortSet
();
from_parent
.add
(
move
from_parent_
);
from_parent
.add
(
from_parent_
);
let
size
=
uint
::
from_str
(
args
[
1
])
.get
();
let
workers
=
uint
::
from_str
(
args
[
2
])
.get
();
...
...
@@ -63,10 +63,10 @@ fn run(args: &[~str]) {
let
mut
worker_results
=
~
[];
for
uint
::
range
(
0
,
workers
)
|
_
i
|
{
let
(
from_parent_
,
to_child
)
=
pipes
::
stream
();
from_parent
.add
(
move
from_parent_
);
from_parent
.add
(
from_parent_
);
do
task
::
task
()
.future_result
(|
+
r
|
{
worker_results
.push
(
move
r
);
})
.spawn
|
move
to_child
|
{
worker_results
.push
(
r
);
})
.spawn
||
{
for
uint
::
range
(
0
,
size
/
workers
)
|
_
i
|
{
//error!("worker %?: sending %? bytes", i, num_bytes);
to_child
.send
(
bytes
(
num_bytes
));
...
...
@@ -74,7 +74,7 @@ fn run(args: &[~str]) {
//error!("worker %? exiting", i);
};
}
do
task
::
spawn
|
move
from_parent
,
move
to_parent
|
{
do
task
::
spawn
||
{
server
(
from_parent
,
to_parent
);
}
...
...
src/test/bench/msgsend-ring-mutex-arcs.rs
浏览文件 @
178882c9
...
...
@@ -40,7 +40,7 @@ fn recv(p: &pipe) -> uint {
fn
init
()
->
(
pipe
,
pipe
)
{
let
m
=
arc
::
MutexARC
(
~
[]);
((
&
m
)
.clone
(),
m
ove
m
)
((
&
m
)
.clone
(),
m
)
}
...
...
@@ -48,18 +48,18 @@ fn thread_ring(i: uint,
count
:
uint
,
+
num_chan
:
pipe
,
+
num_port
:
pipe
)
{
let
mut
num_chan
=
move
Some
(
move
num_chan
);
let
mut
num_port
=
move
Some
(
move
num_port
);
let
mut
num_chan
=
Some
(
num_chan
);
let
mut
num_port
=
Some
(
num_port
);
// Send/Receive lots of messages.
for
uint
::
range
(
0u
,
count
)
|
j
|
{
//error!("task %?, iter %?", i, j);
let
mut
num_chan2
=
option
::
swap_unwrap
(
&
mut
num_chan
);
let
mut
num_port2
=
option
::
swap_unwrap
(
&
mut
num_port
);
send
(
&
num_chan2
,
i
*
j
);
num_chan
=
Some
(
move
num_chan2
);
num_chan
=
Some
(
num_chan2
);
let
_
n
=
recv
(
&
num_port2
);
//log(error, _n);
num_port
=
Some
(
move
num_port2
);
num_port
=
Some
(
num_port2
);
};
}
...
...
@@ -77,7 +77,7 @@ fn main() {
let
msg_per_task
=
uint
::
from_str
(
args
[
2
])
.get
();
let
(
num_chan
,
num_port
)
=
init
();
let
mut
num_chan
=
Some
(
move
num_chan
);
let
mut
num_chan
=
Some
(
num_chan
);
let
start
=
time
::
precise_time_s
();
...
...
@@ -89,22 +89,22 @@ fn main() {
let
(
new_chan
,
num_port
)
=
init
();
let
num_chan2
=
~
mut
None
;
*
num_chan2
<->
num_chan
;
let
num_port
=
~
mut
Some
(
move
num_port
);
let
new_future
=
future
::
spawn
(|
move
num_chan2
,
move
num_port
|
{
let
num_port
=
~
mut
Some
(
num_port
);
let
new_future
=
do
future
::
spawn
()
|
|
{
let
mut
num_chan
=
None
;
num_chan
<->
*
num_chan2
;
let
mut
num_port1
=
None
;
num_port1
<->
*
num_port
;
thread_ring
(
i
,
msg_per_task
,
option
::
unwrap
(
move
num_chan
),
option
::
unwrap
(
move
num_port1
))
}
)
;
futures
.push
(
move
new_future
);
num_chan
=
Some
(
move
new_chan
);
option
::
unwrap
(
num_chan
),
option
::
unwrap
(
num_port1
))
};
futures
.push
(
new_future
);
num_chan
=
Some
(
new_chan
);
};
// do our iteration
thread_ring
(
0
,
msg_per_task
,
option
::
unwrap
(
move
num_chan
),
move
num_port
);
thread_ring
(
0
,
msg_per_task
,
option
::
unwrap
(
num_chan
),
num_port
);
// synchronize
for
futures
.each
|
f
|
{
f
.get
()
};
...
...
src/test/bench/msgsend-ring-pipes.rs
浏览文件 @
178882c9
...
...
@@ -29,15 +29,15 @@
)
macro_rules!
move_out
(
(
$x:expr
)
=>
{
unsafe
{
let
y
=
move
*
ptr
::
addr_of
(
&
$x
);
move
y
}
}
(
$x:expr
)
=>
{
unsafe
{
let
y
=
*
ptr
::
addr_of
(
&
$x
);
y
}
}
)
fn
thread_ring
(
i
:
uint
,
count
:
uint
,
+
num_chan
:
ring
::
client
::
num
,
+
num_port
:
ring
::
server
::
num
)
{
let
mut
num_chan
=
move
Some
(
move
num_chan
);
let
mut
num_port
=
move
Some
(
move
num_port
);
let
mut
num_chan
=
Some
(
num_chan
);
let
mut
num_port
=
Some
(
num_port
);
// Send/Receive lots of messages.
for
uint
::
range
(
0
,
count
)
|
j
|
{
//error!("task %?, iter %?", i, j);
...
...
@@ -45,9 +45,9 @@ fn thread_ring(i: uint,
let
mut
num_port2
=
None
;
num_chan2
<->
num_chan
;
num_port2
<->
num_port
;
num_chan
=
Some
(
ring
::
client
::
num
(
option
::
unwrap
(
move
num_chan2
),
i
*
j
));
let
port
=
option
::
unwrap
(
move
num_port2
);
match
recv
(
move
port
)
{
num_chan
=
Some
(
ring
::
client
::
num
(
option
::
unwrap
(
num_chan2
),
i
*
j
));
let
port
=
option
::
unwrap
(
num_port2
);
match
recv
(
port
)
{
ring
::
num
(
_
n
,
p
)
=>
{
//log(error, _n);
num_port
=
Some
(
move_out!
(
p
));
...
...
@@ -70,7 +70,7 @@ fn main() {
let
msg_per_task
=
uint
::
from_str
(
args
[
2
])
.get
();
let
(
num_chan
,
num_port
)
=
ring
::
init
();
let
mut
num_chan
=
Some
(
move
num_chan
);
let
mut
num_chan
=
Some
(
num_chan
);
let
start
=
time
::
precise_time_s
();
...
...
@@ -82,23 +82,22 @@ fn main() {
let
(
new_chan
,
num_port
)
=
ring
::
init
();
let
num_chan2
=
~
mut
None
;
*
num_chan2
<->
num_chan
;
let
num_port
=
~
mut
Some
(
move
num_port
);
let
new_future
=
do
future
::
spawn
|
move
num_chan2
,
move
num_port
|
{
let
num_port
=
~
mut
Some
(
num_port
);
let
new_future
=
do
future
::
spawn
||
{
let
mut
num_chan
=
None
;
num_chan
<->
*
num_chan2
;
let
mut
num_port1
=
None
;
num_port1
<->
*
num_port
;
thread_ring
(
i
,
msg_per_task
,
option
::
unwrap
(
move
num_chan
),
option
::
unwrap
(
move
num_port1
))
option
::
unwrap
(
num_chan
),
option
::
unwrap
(
num_port1
))
};
futures
.push
(
move
new_future
);
num_chan
=
Some
(
move
new_chan
);
futures
.push
(
new_future
);
num_chan
=
Some
(
new_chan
);
};
// do our iteration
thread_ring
(
0
,
msg_per_task
,
option
::
unwrap
(
move
num_chan
),
move
num_port
);
thread_ring
(
0
,
msg_per_task
,
option
::
unwrap
(
num_chan
),
num_port
);
// synchronize
for
futures
.each
|
f
|
{
f
.get
()
};
...
...
src/test/bench/msgsend-ring-rw-arcs.rs
浏览文件 @
178882c9
...
...
@@ -40,7 +40,7 @@ fn recv(p: &pipe) -> uint {
fn
init
()
->
(
pipe
,
pipe
)
{
let
x
=
arc
::
RWARC
(
~
[]);
((
&
x
)
.clone
(),
move
x
)
((
&
x
)
.clone
(),
x
)
}
...
...
@@ -48,18 +48,18 @@ fn thread_ring(i: uint,
count
:
uint
,
+
num_chan
:
pipe
,
+
num_port
:
pipe
)
{
let
mut
num_chan
=
move
Some
(
move
num_chan
);
let
mut
num_port
=
move
Some
(
move
num_port
);
let
mut
num_chan
=
Some
(
num_chan
);
let
mut
num_port
=
Some
(
num_port
);
// Send/Receive lots of messages.
for
uint
::
range
(
0u
,
count
)
|
j
|
{
//error!("task %?, iter %?", i, j);
let
mut
num_chan2
=
option
::
swap_unwrap
(
&
mut
num_chan
);
let
mut
num_port2
=
option
::
swap_unwrap
(
&
mut
num_port
);
send
(
&
num_chan2
,
i
*
j
);
num_chan
=
Some
(
move
num_chan2
);
num_chan
=
Some
(
num_chan2
);
let
_
n
=
recv
(
&
num_port2
);
//log(error, _n);
num_port
=
Some
(
move
num_port2
);
num_port
=
Some
(
num_port2
);
};
}
...
...
@@ -77,7 +77,7 @@ fn main() {
let
msg_per_task
=
uint
::
from_str
(
args
[
2
])
.get
();
let
(
num_chan
,
num_port
)
=
init
();
let
mut
num_chan
=
Some
(
move
num_chan
);
let
mut
num_chan
=
Some
(
num_chan
);
let
start
=
time
::
precise_time_s
();
...
...
@@ -89,23 +89,22 @@ fn main() {
let
(
new_chan
,
num_port
)
=
init
();
let
num_chan2
=
~
mut
None
;
*
num_chan2
<->
num_chan
;
let
num_port
=
~
mut
Some
(
move
num_port
);
let
new_future
=
do
future
::
spawn
|
move
num_chan2
,
move
num_port
|
{
let
num_port
=
~
mut
Some
(
num_port
);
let
new_future
=
do
future
::
spawn
||
{
let
mut
num_chan
=
None
;
num_chan
<->
*
num_chan2
;
let
mut
num_port1
=
None
;
num_port1
<->
*
num_port
;
thread_ring
(
i
,
msg_per_task
,
option
::
unwrap
(
move
num_chan
),
option
::
unwrap
(
move
num_port1
))
option
::
unwrap
(
num_chan
),
option
::
unwrap
(
num_port1
))
};
futures
.push
(
move
new_future
);
num_chan
=
Some
(
move
new_chan
);
futures
.push
(
new_future
);
num_chan
=
Some
(
new_chan
);
};
// do our iteration
thread_ring
(
0
,
msg_per_task
,
option
::
unwrap
(
move
num_chan
),
move
num_port
);
thread_ring
(
0
,
msg_per_task
,
option
::
unwrap
(
num_chan
),
num_port
);
// synchronize
for
futures
.each
|
f
|
{
f
.get
()
};
...
...
src/test/bench/noise.rs
浏览文件 @
178882c9
...
...
@@ -35,8 +35,8 @@ fn Noise2DContext() -> ~Noise2DContext {
r
.shuffle_mut
(
permutations
);
~
Noise2DContext
{
rgradients
:
move
rgradients
,
permutations
:
move
permutations
,
rgradients
:
rgradients
,
permutations
:
permutations
,
}
}
...
...
src/test/bench/pingpong.rs
浏览文件 @
178882c9
...
...
@@ -45,17 +45,17 @@
// This stuff should go in libcore::pipes
macro_rules!
move_it
(
{
$x:expr
}
=>
{
let
t
=
move
*
ptr
::
addr_of
(
&
(
$x
));
move
t
}
{
$x:expr
}
=>
{
let
t
=
*
ptr
::
addr_of
(
&
(
$x
));
t
}
)
macro_rules!
follow
(
{
$
(
$message:path
(
$
(
$x
:
ident
),
+
)
->
$next:ident
$e:expr
)
+
}
=>
(
|
m
|
match
m
ove
m
{
$
(
Some
(
$message
(
$
(
$x
,)
*
move
next
))
=>
{
let
$next
=
move
next
;
move
$e
})
+
|
m
|
match
m
{
$
(
Some
(
$message
(
$
(
$x
,)
*
next
))
=>
{
let
$next
=
next
;
$e
})
+
_
=>
{
fail!
()
}
}
);
...
...
@@ -63,10 +63,10 @@
{
$
(
$message:path
->
$next:ident
$e:expr
)
+
}
=>
(
|
m
|
match
m
ove
m
{
$
(
Some
(
$message
(
move
next
))
=>
{
let
$next
=
move
next
;
move
$e
})
+
|
m
|
match
m
{
$
(
Some
(
$message
(
next
))
=>
{
let
$next
=
next
;
$e
})
+
_
=>
{
fail!
()
}
}
)
...
...
@@ -74,7 +74,7 @@
fn
switch
<
T
:
Owned
,
Tb
:
Owned
,
U
>
(
+
endp
:
pipes
::
RecvPacketBuffered
<
T
,
Tb
>
,
f
:
fn
(
+
v
:
Option
<
T
>
)
->
U
)
->
U
{
f
(
pipes
::
try_recv
(
move
endp
))
f
(
pipes
::
try_recv
(
endp
))
}
// Here's the benchmark
...
...
@@ -84,10 +84,10 @@ fn bounded(count: uint) {
let
mut
ch
=
do
spawn_service
(
init
)
|
ch
|
{
let
mut
count
=
count
;
let
mut
ch
=
move
ch
;
let
mut
ch
=
ch
;
while
count
>
0
{
ch
=
switch
(
move
ch
,
follow!
(
ping
->
next
{
server
::
pong
(
move
next
)
}
ch
=
switch
(
ch
,
follow!
(
ping
->
next
{
server
::
pong
(
next
)
}
));
count
-=
1
;
...
...
@@ -96,10 +96,10 @@ fn bounded(count: uint) {
let
mut
count
=
count
;
while
count
>
0
{
let
ch_
=
client
::
ping
(
move
ch
);
let
ch_
=
client
::
ping
(
ch
);
ch
=
switch
(
move
ch_
,
follow!
(
pong
->
next
{
move
next
}
ch
=
switch
(
ch_
,
follow!
(
pong
->
next
{
next
}
));
count
-=
1
;
...
...
@@ -111,10 +111,10 @@ fn unbounded(count: uint) {
let
mut
ch
=
do
spawn_service
(
init
)
|
ch
|
{
let
mut
count
=
count
;
let
mut
ch
=
move
ch
;
let
mut
ch
=
ch
;
while
count
>
0
{
ch
=
switch
(
move
ch
,
follow!
(
ping
->
next
{
server
::
pong
(
move
next
)
}
ch
=
switch
(
ch
,
follow!
(
ping
->
next
{
server
::
pong
(
next
)
}
));
count
-=
1
;
...
...
@@ -123,10 +123,10 @@ fn unbounded(count: uint) {
let
mut
count
=
count
;
while
count
>
0
{
let
ch_
=
client
::
ping
(
move
ch
);
let
ch_
=
client
::
ping
(
ch
);
ch
=
switch
(
move
ch_
,
follow!
(
pong
->
next
{
move
next
}
ch
=
switch
(
ch_
,
follow!
(
pong
->
next
{
next
}
));
count
-=
1
;
...
...
src/test/bench/shootout-chameneos-redux.rs
浏览文件 @
178882c9
...
...
@@ -156,7 +156,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
let
to_rendezvous_log
=
to_rendezvous_log
.clone
();
let
(
from_rendezvous
,
to_creature
)
=
stream
();
let
from_rendezvous
=
Cell
(
from_rendezvous
);
do
task
::
spawn
|
move
ii
,
move
col
|
{
do
task
::
spawn
||
{
creature
(
ii
,
col
,
from_rendezvous
.take
(),
to_rendezvous
.clone
(),
to_rendezvous_log
.clone
());
}
...
...
src/test/bench/shootout-k-nucleotide-pipes.rs
浏览文件 @
178882c9
...
...
@@ -128,7 +128,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
_
=>
{
~
""
}
};
to_parent
.send
(
move
buffer
);
to_parent
.send
(
buffer
);
}
// given a FASTA file on stdin, process sequence THREE
...
...
@@ -149,23 +149,23 @@ fn main() {
// initialize each sequence sorter
let
sizes
=
~
[
1
,
2
,
3
,
4
,
6
,
12
,
18
];
let
streams
=
vec
::
map
(
sizes
,
|
_
sz
|
Some
(
stream
()));
let
mut
streams
=
move
streams
;
let
mut
streams
=
streams
;
let
mut
from_child
=
~
[];
let
to_child
=
vec
::
mapi
(
sizes
,
|
ii
,
sz
|
{
let
sz
=
*
sz
;
let
mut
stream
=
None
;
stream
<->
streams
[
ii
];
let
(
from_child_
,
to_parent_
)
=
option
::
unwrap
(
move
stream
);
let
(
from_child_
,
to_parent_
)
=
option
::
unwrap
(
stream
);
from_child
.push
(
move
from_child_
);
from_child
.push
(
from_child_
);
let
(
from_parent
,
to_child
)
=
pipes
::
stream
();
do
task
::
spawn_with
(
move
from_parent
)
|
move
to_parent_
,
from_parent
|
{
do
task
::
spawn_with
(
from_parent
)
|
from_parent
|
{
make_sequence_processor
(
sz
,
from_parent
,
to_parent_
);
};
move
to_child
to_child
});
...
...
src/test/bench/shootout-mandelbrot.rs
浏览文件 @
178882c9
...
...
@@ -172,7 +172,7 @@ fn main() {
let
pchan
=
pipes
::
SharedChan
(
pchan
);
for
uint
::
range
(
0_u
,
size
)
|
j
|
{
let
cchan
=
pchan
.clone
();
do
task
::
spawn
|
move
cchan
|
{
cchan
.send
(
chanmb
(
j
,
size
))
};
do
task
::
spawn
||
{
cchan
.send
(
chanmb
(
j
,
size
))
};
};
writer
(
path
,
pport
,
size
);
}
src/test/bench/shootout-pfib.rs
浏览文件 @
178882c9
...
...
@@ -43,15 +43,15 @@ fn pfib(c: Chan<int>, n: int) {
}
else
{
let
p
=
pipes
::
PortSet
();
let
ch
=
p
.chan
();
task
::
spawn
(|
move
ch
|
pfib
(
ch
,
n
-
1
)
);
task
::
spawn
(||
pfib
(
ch
,
n
-
1
)
);
let
ch
=
p
.chan
();
task
::
spawn
(|
move
ch
|
pfib
(
ch
,
n
-
2
)
);
task
::
spawn
(||
pfib
(
ch
,
n
-
2
)
);
c
.send
(
p
.recv
()
+
p
.recv
());
}
}
let
(
p
,
ch
)
=
pipes
::
stream
();
let
_
t
=
task
::
spawn
(|
move
ch
|
pfib
(
ch
,
n
)
);
let
_
t
=
task
::
spawn
(||
pfib
(
ch
,
n
)
);
p
.recv
()
}
...
...
@@ -86,7 +86,7 @@ fn stress(num_tasks: int) {
let
mut
results
=
~
[];
for
range
(
0
,
num_tasks
)
|
i
|
{
do
task
::
task
()
.future_result
(|
+
r
|
{
results
.push
(
move
r
);
results
.push
(
r
);
})
.spawn
{
stress_task
(
i
);
}
...
...
src/test/bench/task-perf-alloc-unwind.rs
浏览文件 @
178882c9
...
...
@@ -99,6 +99,6 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
}
};
recurse_or_fail
(
depth
,
Some
(
move
st
));
recurse_or_fail
(
depth
,
Some
(
st
));
}
}
src/test/bench/task-perf-jargon-metal-smoke.rs
浏览文件 @
178882c9
...
...
@@ -19,14 +19,14 @@ fn child_generation(gens_left: uint, -c: pipes::Chan<()>) {
// This used to be O(n^2) in the number of generations that ever existed.
// With this code, only as many generations are alive at a time as tasks
// alive at a time,
let
c
=
~
mut
Some
(
move
c
);
do
task
::
spawn_supervised
|
move
c
|
{
let
c
=
~
mut
Some
(
c
);
do
task
::
spawn_supervised
||
{
let
c
=
option
::
swap_unwrap
(
c
);
if
gens_left
&
1
==
1
{
task
::
yield
();
// shake things up a bit
}
if
gens_left
>
0
{
child_generation
(
gens_left
-
1
,
move
c
);
// recurse
child_generation
(
gens_left
-
1
,
c
);
// recurse
}
else
{
c
.send
(())
}
...
...
@@ -44,7 +44,7 @@ fn main() {
};
let
(
p
,
c
)
=
pipes
::
stream
();
child_generation
(
uint
::
from_str
(
args
[
1
])
.get
(),
move
c
);
child_generation
(
uint
::
from_str
(
args
[
1
])
.get
(),
c
);
if
p
.try_recv
()
.is_none
()
{
fail
!
(
~
"it happened when we slumbered"
);
}
...
...
src/test/bench/task-perf-linked-failure.rs
浏览文件 @
178882c9
...
...
@@ -46,9 +46,9 @@ fn grandchild_group(num_tasks: uint) {
fn
spawn_supervised_blocking
(
myname
:
&
str
,
+
f
:
fn
~
())
{
let
mut
res
=
None
;
task
::
task
()
.future_result
(|
+
r
|
res
=
Some
(
move
r
))
.supervised
()
.spawn
(
move
f
);
task
::
task
()
.future_result
(|
+
r
|
res
=
Some
(
r
))
.supervised
()
.spawn
(
f
);
error!
(
"%s group waiting"
,
myname
);
let
x
=
option
::
unwrap
(
move
res
)
.recv
();
let
x
=
option
::
unwrap
(
res
)
.recv
();
assert
x
==
task
::
Success
;
}
...
...
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs
浏览文件 @
178882c9
...
...
@@ -18,8 +18,8 @@ fn finalize(&self) {
fn
main
()
{
let
x
=
Some
(
X
{
x
:
()
});
match
move
x
{
Some
(
ref
_
y
@
move
_
z
)
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
match
x
{
Some
(
ref
_
y
@
_
z
)
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
None
=>
fail
!
()
}
}
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs
浏览文件 @
178882c9
...
...
@@ -18,8 +18,8 @@ fn finalize(&self) {
fn
main
()
{
let
x
=
Some
((
X
{
x
:
()
},
X
{
x
:
()
}));
match
move
x
{
Some
((
ref
_
y
,
move
_
z
))
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
match
x
{
Some
((
ref
_
y
,
_
z
))
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
None
=>
fail
!
()
}
}
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs
浏览文件 @
178882c9
...
...
@@ -20,8 +20,8 @@ enum double_option<T,U> { some2(T,U), none2 }
fn
main
()
{
let
x
=
some2
(
X
{
x
:
()
},
X
{
x
:
()
});
match
move
x
{
some2
(
ref
_
y
,
move
_
z
)
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
match
x
{
some2
(
ref
_
y
,
_
z
)
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
none2
=>
fail
!
()
}
}
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs
浏览文件 @
178882c9
...
...
@@ -18,8 +18,8 @@ fn finalize(&self) {
fn
main
()
{
let
x
=
Some
((
X
{
x
:
()
},
X
{
x
:
()
}));
match
move
x
{
Some
((
move
_
y
,
ref
_
z
))
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
match
x
{
Some
((
_
y
,
ref
_
z
))
=>
{
},
//~ ERROR cannot bind by-move and by-ref in the same pattern
None
=>
fail
!
()
}
}
src/test/compile-fail/bind-by-move-no-guards.rs
浏览文件 @
178882c9
...
...
@@ -12,9 +12,9 @@ fn main() {
let
(
p
,
c
)
=
pipes
::
stream
();
let
x
=
Some
(
p
);
c
.send
(
false
);
match
move
x
{
Some
(
move
z
)
if
z
.recv
()
=>
{
fail
!
()
},
//~ ERROR cannot bind by-move into a pattern guard
Some
(
move
z
)
=>
{
assert
!
z
.recv
();
},
match
x
{
Some
(
z
)
if
z
.recv
()
=>
{
fail
!
()
},
//~ ERROR cannot bind by-move into a pattern guard
Some
(
z
)
=>
{
assert
!
z
.recv
();
},
None
=>
fail
!
()
}
}
src/test/compile-fail/bind-by-move-no-lvalues-1.rs
浏览文件 @
178882c9
...
...
@@ -21,7 +21,7 @@ fn finalize(&self) {
fn
main
()
{
let
x
=
Some
(
X
{
x
:
()
});
match
x
{
Some
(
move
_
z
)
=>
{
},
//~ ERROR cannot bind by-move when matching an lvalue
Some
(
_
z
)
=>
{
},
//~ ERROR cannot bind by-move when matching an lvalue
None
=>
fail
!
()
}
}
src/test/compile-fail/bind-by-move-no-lvalues-2.rs
浏览文件 @
178882c9
...
...
@@ -23,7 +23,7 @@ struct Y { y: Option<X> }
fn
main
()
{
let
x
=
Y
{
y
:
Some
(
X
{
x
:
()
})
};
match
x
.y
{
Some
(
move
_
z
)
=>
{
},
//~ ERROR cannot bind by-move when matching an lvalue
Some
(
_
z
)
=>
{
},
//~ ERROR cannot bind by-move when matching an lvalue
None
=>
fail
!
()
}
}
src/test/compile-fail/bind-by-move-no-sub-bindings.rs
浏览文件 @
178882c9
...
...
@@ -18,8 +18,8 @@ fn finalize(&self) {
fn
main
()
{
let
x
=
Some
(
X
{
x
:
()
});
match
move
x
{
Some
(
move
_
y
@
ref
_
z
)
=>
{
},
//~ ERROR cannot bind by-move with sub-bindings
match
x
{
Some
(
_
y
@
ref
_
z
)
=>
{
},
//~ ERROR cannot bind by-move with sub-bindings
None
=>
fail
!
()
}
}
src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
浏览文件 @
178882c9
...
...
@@ -20,6 +20,6 @@ impl Add<foo, foo> for foo {
fn
main
()
{
let
x
=
foo
(
~
3
);
let
_
y
=
x
+
move
x
;
let
_
y
=
x
+
x
;
//~^ ERROR moving out of immutable local variable prohibited due to outstanding loan
}
src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs
浏览文件 @
178882c9
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
fn
foo
(
x
:
*~
int
)
->
~
int
{
let
y
=
move
*
x
;
//~ ERROR dereference of unsafe pointer requires unsafe function or block
let
y
=
*
x
;
//~ ERROR dereference of unsafe pointer requires unsafe function or block
return
y
;
}
...
...
src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
浏览文件 @
178882c9
...
...
@@ -4,7 +4,7 @@ fn a() -> &[int] {
[
_
a
,
..
tail
]
=>
tail
,
_
=>
fail
!
(
~
"foo"
)
};
move
tail
tail
}
fn
main
()
{
...
...
src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
浏览文件 @
178882c9
...
...
@@ -4,7 +4,7 @@ fn a() -> &int {
[
_
a
,
..
tail
]
=>
&
tail
[
0
],
_
=>
fail
!
(
~
"foo"
)
};
move
tail
tail
}
fn
main
()
{
...
...
src/test/compile-fail/copy-a-resource.rs
浏览文件 @
178882c9
...
...
@@ -23,7 +23,7 @@ fn foo(i:int) -> foo {
}
fn
main
()
{
let
x
=
move
foo
(
10
);
let
x
=
foo
(
10
);
let
_
y
=
copy
x
;
//~^ ERROR copying a value of non-copyable type `foo`
log
(
error
,
x
);
...
...
src/test/compile-fail/issue-2548.rs
浏览文件 @
178882c9
...
...
@@ -34,7 +34,7 @@ fn main() {
let
mut
res
=
foo
(
x
);
let
mut
v
=
~
[];
v
=
move
~
[(
move
res
)]
+
v
;
//~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Copy`
v
=
~
[(
res
)]
+
v
;
//~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Copy`
assert
(
v
.len
()
==
2
);
}
...
...
src/test/compile-fail/issue-3177-mutable-struct.rs
浏览文件 @
178882c9
...
...
@@ -17,5 +17,5 @@ struct S<T: Const> {
fn
main
()
{
let
a1
=
~
S
{
s
:
true
,
cant_nest
:
()
};
let
_
a2
=
~
S
{
s
:
move
a1
,
cant_nest
:
()
};
let
_
a2
=
~
S
{
s
:
a1
,
cant_nest
:
()
};
}
src/test/compile-fail/kindck-nonsendable-1.rs
浏览文件 @
178882c9
...
...
@@ -14,5 +14,5 @@ fn main() {
let
x
=
@
3u
;
let
_
=
fn
~
()
{
foo
(
x
);
};
//~ ERROR value has non-owned type `@uint`
let
_
=
fn
~
(
copy
x
)
{
foo
(
x
);
};
//~ ERROR value has non-owned type `@uint`
let
_
=
fn
~
(
move
x
)
{
foo
(
x
);
};
//~ ERROR value has non-owned type `@uint`
let
_
=
fn
~
()
{
foo
(
x
);
};
//~ ERROR value has non-owned type `@uint`
}
src/test/compile-fail/liveness-unused.rs
浏览文件 @
178882c9
...
...
@@ -68,5 +68,5 @@ fn finalize(&self) {}
fn
main
()
{
let
x
=
r
{
x
:
()
};
fn
@
(
move
x
)
{
copy
x
;
};
//~ ERROR copying a value of non-copyable type
fn
@
()
{
copy
x
;
};
//~ ERROR copying a value of non-copyable type
}
src/test/compile-fail/noncopyable-class.rs
浏览文件 @
178882c9
...
...
@@ -37,7 +37,7 @@ fn foo(i:int) -> foo {
}
fn
main
()
{
let
x
=
move
foo
(
10
);
let
x
=
foo
(
10
);
let
_
y
=
copy
x
;
//~ ERROR copying a value of non-copyable type
log
(
error
,
x
);
}
src/test/compile-fail/unique-pinned-nocopy.rs
浏览文件 @
178882c9
...
...
@@ -17,7 +17,7 @@ fn finalize(&self) {}
}
fn
main
()
{
let
i
=
move
~
r
{
b
:
true
};
let
i
=
~
r
{
b
:
true
};
let
_
j
=
copy
i
;
//~ ERROR copying a value of non-copyable type
log
(
debug
,
i
);
}
src/test/compile-fail/unique-unique-kind.rs
浏览文件 @
178882c9
...
...
@@ -13,5 +13,5 @@ fn f<T: Owned>(_i: T) {
fn
main
()
{
let
i
=
~@
100
;
f
(
move
i
);
//~ ERROR does not fulfill `Owned`
f
(
i
);
//~ ERROR does not fulfill `Owned`
}
src/test/compile-fail/unique-vec-res.rs
浏览文件 @
178882c9
...
...
@@ -24,8 +24,8 @@ fn f<T>(+_i: ~[T], +_j: ~[T]) {
fn
main
()
{
let
i1
=
@
mut
0
;
let
i2
=
@
mut
1
;
let
r1
=
move
~
[
~
r
{
i
:
i1
}];
let
r2
=
move
~
[
~
r
{
i
:
i2
}];
let
r1
=
~
[
~
r
{
i
:
i1
}];
let
r2
=
~
[
~
r
{
i
:
i2
}];
f
(
copy
r1
,
copy
r2
);
//~^ ERROR copying a value of non-copyable type
//~^^ ERROR copying a value of non-copyable type
...
...
src/test/compile-fail/unsendable-class.rs
浏览文件 @
178882c9
...
...
@@ -26,5 +26,5 @@ fn foo(i:int, j: @~str) -> foo {
fn
main
()
{
let
cat
=
~
"kitty"
;
let
(
_
,
ch
)
=
pipes
::
stream
();
//~ ERROR does not fulfill `Owned`
ch
.send
(
foo
(
42
,
@
(
move
cat
)));
//~ ERROR does not fulfill `Owned`
ch
.send
(
foo
(
42
,
@
(
cat
)));
//~ ERROR does not fulfill `Owned`
}
src/test/compile-fail/vec-res-add.rs
浏览文件 @
178882c9
...
...
@@ -22,8 +22,8 @@ fn finalize(&self) {}
fn
main
()
{
// This can't make sense as it would copy the classes
let
i
=
move
~
[
r
(
0
)];
let
j
=
move
~
[
r
(
1
)];
let
i
=
~
[
r
(
0
)];
let
j
=
~
[
r
(
1
)];
let
k
=
i
+
j
;
log
(
debug
,
j
);
}
src/test/run-fail/out-of-stack-managed-box.rs
浏览文件 @
178882c9
...
...
@@ -15,11 +15,11 @@
// error-pattern:ran out of stack
fn
main
()
{
eat
(
move
@
0
);
eat
(
@
0
);
}
fn
eat
(
+
a
:
@
int
)
{
eat
(
move
a
)
eat
(
a
)
}
src/test/run-fail/out-of-stack-owned-box.rs
浏览文件 @
178882c9
...
...
@@ -11,11 +11,11 @@
// xfail-test
// error-pattern:ran out of stack
fn
main
()
{
eat
(
move
~
0
);
eat
(
~
0
);
}
fn
eat
(
+
a
:
~
int
)
{
eat
(
move
a
)
eat
(
a
)
}
src/test/run-fail/unwind-box-res.rs
浏览文件 @
178882c9
...
...
@@ -36,7 +36,7 @@ fn main() {
unsafe
{
let
i1
=
~
0
;
let
i1p
=
cast
::
reinterpret_cast
(
&
i1
);
cast
::
forget
(
move
i1
);
cast
::
forget
(
i1
);
let
x
=
@
r
(
i1p
);
failfn
();
log
(
error
,
x
);
...
...
src/test/run-fail/unwind-closure.rs
浏览文件 @
178882c9
...
...
@@ -16,6 +16,6 @@ fn f(a: @int) {
fn
main
()
{
let
b
=
@
0
;
let
g
:
fn
@
()
=
|
move
b
|
f
(
b
);
let
g
:
fn
@
()
=
|
|
f
(
b
);
g
();
}
src/test/run-fail/unwind-move.rs
浏览文件 @
178882c9
...
...
@@ -15,5 +15,5 @@ fn f(-_a: @int) {
fn
main
()
{
let
a
=
@
0
;
f
(
move
a
);
f
(
a
);
}
src/test/run-fail/unwind-resource-fail.rs
浏览文件 @
178882c9
...
...
@@ -19,5 +19,5 @@ fn r(i: int) -> r { r { i: i } }
fn
main
()
{
@
0
;
let
r
=
move
r
(
0
);
let
r
=
r
(
0
);
}
src/test/run-fail/unwind-resource-fail2.rs
浏览文件 @
178882c9
...
...
@@ -20,6 +20,6 @@ fn r(i: int) -> r { r { i: i } }
fn
main
()
{
@
0
;
let
r
=
move
r
(
0
);
let
r
=
r
(
0
);
fail
!
();
}
src/test/run-pass/alt-ref-binding-in-guard-3256.rs
浏览文件 @
178882c9
...
...
@@ -10,7 +10,7 @@
pub
fn
main
()
{
let
x
=
Some
(
private
::
exclusive
(
true
));
match
move
x
{
match
x
{
Some
(
ref
z
)
if
z
.with
(|
b
|
*
b
)
=>
{
do
z
.with
|
b
|
{
assert
*
b
;
}
},
...
...
src/test/run-pass/argument-passing.rs
浏览文件 @
178882c9
...
...
@@ -24,7 +24,7 @@ fn f1(a: X, b: &mut int, -c: int) -> int {
pub
fn
main
()
{
let
mut
a
=
X
{
mut
x
:
1
},
b
=
2
,
c
=
3
;
assert
(
f1
(
a
,
&
mut
b
,
move
c
)
==
6
);
assert
(
f1
(
a
,
&
mut
b
,
c
)
==
6
);
assert
(
a
.x
==
0
);
assert
(
b
==
10
);
assert
(
f2
(
a
.x
,
|
x
|
a
.x
=
50
)
==
0
);
...
...
src/test/run-pass/auto-encode.rs
浏览文件 @
178882c9
...
...
@@ -46,7 +46,7 @@ fn test_ebml<A:
let
ebml_w
=
&
EBWriter
::
Encoder
(
wr
);
a1
.encode
(
ebml_w
)
};
let
d
=
EBReader
::
Doc
(
@
move
bytes
);
let
d
=
EBReader
::
Doc
(
@
bytes
);
let
a2
:
A
=
Decodable
::
decode
(
&
EBReader
::
Decoder
(
d
));
assert
*
a1
==
a2
;
}
...
...
src/test/run-pass/auto-ref-sliceable.rs
浏览文件 @
178882c9
...
...
@@ -14,7 +14,7 @@ trait Pushable<T> {
impl
<
T
>
Pushable
<
T
>
for
~
[
T
]
{
fn
push_val
(
&
mut
self
,
+
t
:
T
)
{
self
.push
(
move
t
);
self
.push
(
t
);
}
}
...
...
src/test/run-pass/bind-by-move.rs
浏览文件 @
178882c9
...
...
@@ -17,8 +17,8 @@ fn dispose(+_x: arc::ARC<bool>) unsafe { }
pub
fn
main
()
{
let
p
=
arc
::
arc
(
true
);
let
x
=
Some
(
p
);
match
move
x
{
Some
(
move
z
)
=>
{
dispose
(
z
);
},
match
x
{
Some
(
z
)
=>
{
dispose
(
z
);
},
None
=>
fail
!
()
}
}
src/test/run-pass/borrowck-move-from-unsafe-ptr-ok.rs
浏览文件 @
178882c9
...
...
@@ -12,7 +12,7 @@
fn
bar
(
x
:
*~
int
)
->
~
int
{
unsafe
{
let
y
=
move
*
x
;
let
y
=
*
x
;
return
y
;
}
}
...
...
src/test/run-pass/cap-clause-move.rs
浏览文件 @
178882c9
...
...
@@ -11,21 +11,21 @@
pub
fn
main
()
{
let
x
=
~
1
;
let
y
=
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
let
lam_move
=
fn
@
(
move
x
)
->
uint
{
ptr
::
addr_of
(
&
(
*
x
))
as
uint
};
let
lam_move
=
fn
@
()
->
uint
{
ptr
::
addr_of
(
&
(
*
x
))
as
uint
};
assert
lam_move
()
==
y
;
let
x
=
~
2
;
let
y
=
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
let
lam_move
:
fn
@
()
->
uint
=
|
move
x
|
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
let
lam_move
:
fn
@
()
->
uint
=
||
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
assert
lam_move
()
==
y
;
let
x
=
~
3
;
let
y
=
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
let
snd_move
=
fn
~
(
move
x
)
->
uint
{
ptr
::
addr_of
(
&
(
*
x
))
as
uint
};
let
snd_move
=
fn
~
()
->
uint
{
ptr
::
addr_of
(
&
(
*
x
))
as
uint
};
assert
snd_move
()
==
y
;
let
x
=
~
4
;
let
y
=
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
let
lam_move
:
fn
~
()
->
uint
=
|
move
x
|
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
let
lam_move
:
fn
~
()
->
uint
=
||
ptr
::
addr_of
(
&
(
*
x
))
as
uint
;
assert
lam_move
()
==
y
;
}
src/test/run-pass/class-poly-methods.rs
浏览文件 @
178882c9
...
...
@@ -26,7 +26,7 @@ fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {
cat
{
meows
:
in_x
,
how_hungry
:
in_y
,
info
:
move
in_info
info
:
in_info
}
}
...
...
src/test/run-pass/dvec-test.rs
浏览文件 @
178882c9
...
...
@@ -31,6 +31,6 @@ pub fn main() {
assert
*
e
==
exp
[
i
];
}
let
v
=
dvec
::
unwrap
(
move
d
);
let
v
=
dvec
::
unwrap
(
d
);
assert
v
==
exp
;
}
src/test/run-pass/fn-bare-spawn.rs
浏览文件 @
178882c9
...
...
@@ -11,7 +11,7 @@
// This is what the signature to spawn should look like with bare functions
fn
spawn
<
T
:
Owned
>
(
val
:
T
,
f
:
extern
fn
(
T
))
{
f
(
move
val
);
f
(
val
);
}
fn
f
(
+
i
:
int
)
{
...
...
src/test/run-pass/hashmap-memory.rs
浏览文件 @
178882c9
...
...
@@ -39,7 +39,7 @@ fn start_mappers(ctrl: SharedChan<ctrl_proto>, inputs: ~[~str]) {
for
inputs
.each
|
i
|
{
let
ctrl
=
ctrl
.clone
();
let
i
=
copy
*
i
;
task
::
spawn
(|
move
i
|
map_task
(
ctrl
.clone
(),
copy
i
)
);
task
::
spawn
(||
map_task
(
ctrl
.clone
(),
copy
i
)
);
}
}
...
...
src/test/run-pass/init-res-into-things.rs
浏览文件 @
178882c9
...
...
@@ -32,7 +32,7 @@ fn r(i: @mut int) -> r {
fn
test_box
()
{
let
i
=
@
mut
0
;
{
let
a
=
move
@
r
(
i
);
let
a
=
@
r
(
i
);
}
assert
*
i
==
1
;
}
...
...
@@ -40,7 +40,7 @@ fn test_box() {
fn
test_rec
()
{
let
i
=
@
mut
0
;
{
let
a
=
move
Box
{
x
:
r
(
i
)};
let
a
=
Box
{
x
:
r
(
i
)};
}
assert
*
i
==
1
;
}
...
...
@@ -52,7 +52,7 @@ enum t {
let
i
=
@
mut
0
;
{
let
a
=
move
t0
(
r
(
i
));
let
a
=
t0
(
r
(
i
));
}
assert
*
i
==
1
;
}
...
...
@@ -60,7 +60,7 @@ enum t {
fn
test_tup
()
{
let
i
=
@
mut
0
;
{
let
a
=
move
(
r
(
i
),
0
);
let
a
=
(
r
(
i
),
0
);
}
assert
*
i
==
1
;
}
...
...
@@ -68,7 +68,7 @@ fn test_tup() {
fn
test_unique
()
{
let
i
=
@
mut
0
;
{
let
a
=
move
~
r
(
i
);
let
a
=
~
r
(
i
);
}
assert
*
i
==
1
;
}
...
...
@@ -76,7 +76,7 @@ fn test_unique() {
fn
test_box_rec
()
{
let
i
=
@
mut
0
;
{
let
a
=
move
@
Box
{
let
a
=
@
Box
{
x
:
r
(
i
)
};
}
...
...
src/test/run-pass/intrinsic-move-val.rs
浏览文件 @
178882c9
...
...
@@ -18,7 +18,7 @@ pub fn main() {
unsafe
{
let
mut
x
=
@
1
;
let
mut
y
=
@
2
;
rusti
::
move_val
(
&
mut
y
,
move
x
);
rusti
::
move_val
(
&
mut
y
,
x
);
assert
*
y
==
1
;
}
}
src/test/run-pass/issue-1895.rs
浏览文件 @
178882c9
...
...
@@ -10,7 +10,7 @@
pub
fn
main
()
{
let
x
=
1
;
let
y
=
fn
@
(
move
x
)
->
int
{
let
y
=
fn
@
()
->
int
{
x
}();
}
...
...
src/test/run-pass/issue-2185.rs
浏览文件 @
178882c9
...
...
@@ -35,11 +35,11 @@ fn filter<A,IA:iterable<A>>(self: IA, prd: fn@(A) -> bool, blk: fn(A)) {
}
fn
foldl
<
A
,
B
,
IA
:
iterable
<
A
>>
(
self
:
IA
,
+
b0
:
B
,
blk
:
fn
(
B
,
A
)
->
B
)
->
B
{
let
mut
b
=
move
b0
;
let
mut
b
=
b0
;
do
self
.iter
|
a
|
{
b
=
move
blk
(
b
,
a
);
b
=
blk
(
b
,
a
);
}
move
b
b
}
fn
range
(
lo
:
uint
,
hi
:
uint
,
it
:
fn
(
uint
))
{
...
...
src/test/run-pass/issue-2718.rs
浏览文件 @
178882c9
...
...
@@ -61,18 +61,18 @@ mod rusti {
// We should consider moving this to ::core::unsafe, although I
// suspect graydon would want us to use void pointers instead.
pub
unsafe
fn
uniquify
<
T
>
(
+
x
:
*
T
)
->
~
T
{
unsafe
{
cast
::
transmute
(
move
x
)
}
unsafe
{
cast
::
transmute
(
x
)
}
}
pub
fn
swap_state_acq
(
+
dst
:
&
mut
state
,
src
:
state
)
->
state
{
unsafe
{
transmute
(
rusti
::
atomic_xchg_acq
(
transmute
(
move
dst
),
src
as
int
))
transmute
(
rusti
::
atomic_xchg_acq
(
transmute
(
dst
),
src
as
int
))
}
}
pub
fn
swap_state_rel
(
+
dst
:
&
mut
state
,
src
:
state
)
->
state
{
unsafe
{
transmute
(
rusti
::
atomic_xchg_rel
(
transmute
(
move
dst
),
src
as
int
))
transmute
(
rusti
::
atomic_xchg_rel
(
transmute
(
dst
),
src
as
int
))
}
}
...
...
@@ -80,20 +80,20 @@ pub fn send<T: Owned>(-p: send_packet<T>, -payload: T) {
let
p
=
p
.unwrap
();
let
p
=
unsafe
{
uniquify
(
p
)
};
assert
(
*
p
)
.payload
.is_none
();
(
*
p
)
.payload
=
move
Some
(
move
payload
);
(
*
p
)
.payload
=
Some
(
payload
);
let
old_state
=
swap_state_rel
(
&
mut
(
*
p
)
.state
,
full
);
match
old_state
{
empty
=>
{
// Yay, fastpath.
// The receiver will eventually clean this up.
unsafe
{
forget
(
move
p
);
}
unsafe
{
forget
(
p
);
}
}
full
=>
{
fail
!
(
~
"duplicate send"
)
}
blocked
=>
{
// The receiver will eventually clean this up.
unsafe
{
forget
(
move
p
);
}
unsafe
{
forget
(
p
);
}
}
terminated
=>
{
// The receiver will never receive this. Rely on drop_glue
...
...
@@ -113,7 +113,7 @@ pub fn recv<T: Owned>(-p: recv_packet<T>) -> Option<T> {
full
=>
{
let
mut
payload
=
None
;
payload
<->
(
*
p
)
.payload
;
return
Some
(
option
::
unwrap
(
move
payload
))
return
Some
(
option
::
unwrap
(
payload
))
}
terminated
=>
{
assert
old_state
==
terminated
;
...
...
@@ -128,7 +128,7 @@ pub fn sender_terminate<T: Owned>(p: *packet<T>) {
match
swap_state_rel
(
&
mut
(
*
p
)
.state
,
terminated
)
{
empty
|
blocked
=>
{
// The receiver will eventually clean up.
unsafe
{
forget
(
move
p
)
}
unsafe
{
forget
(
p
)
}
}
full
=>
{
// This is impossible
...
...
@@ -145,7 +145,7 @@ pub fn receiver_terminate<T: Owned>(p: *packet<T>) {
match
swap_state_rel
(
&
mut
(
*
p
)
.state
,
terminated
)
{
empty
=>
{
// the sender will clean up
unsafe
{
forget
(
move
p
)
}
unsafe
{
forget
(
p
)
}
}
blocked
=>
{
// this shouldn't happen.
...
...
@@ -166,7 +166,7 @@ fn finalize(&self) {
if
self
.p
!=
None
{
let
mut
p
=
None
;
p
<->
self
.p
;
sender_terminate
(
option
::
unwrap
(
move
p
))
sender_terminate
(
option
::
unwrap
(
p
))
}
}
}
...
...
@@ -175,7 +175,7 @@ pub impl<T: Owned> send_packet<T> {
fn
unwrap
()
->
*
packet
<
T
>
{
let
mut
p
=
None
;
p
<->
self
.p
;
option
::
unwrap
(
move
p
)
option
::
unwrap
(
p
)
}
}
...
...
@@ -194,7 +194,7 @@ fn finalize(&self) {
if
self
.p
!=
None
{
let
mut
p
=
None
;
p
<->
self
.p
;
receiver_terminate
(
option
::
unwrap
(
move
p
))
receiver_terminate
(
option
::
unwrap
(
p
))
}
}
}
...
...
@@ -203,7 +203,7 @@ pub impl<T: Owned> recv_packet<T> {
fn
unwrap
()
->
*
packet
<
T
>
{
let
mut
p
=
None
;
p
<->
self
.p
;
option
::
unwrap
(
move
p
)
option
::
unwrap
(
p
)
}
}
...
...
@@ -231,9 +231,9 @@ pub fn liberate_ping(-p: ping) -> ::pipes::send_packet<pong> {
let
addr
:
*
::
pipes
::
send_packet
<
pong
>
=
match
&
p
{
&
ping
(
ref
x
)
=>
{
cast
::
transmute
(
ptr
::
addr_of
(
x
))
}
};
let
liberated_value
=
move
*
addr
;
cast
::
forget
(
move
p
);
move
liberated_value
let
liberated_value
=
*
addr
;
cast
::
forget
(
p
);
liberated_value
}
}
...
...
@@ -242,9 +242,9 @@ pub fn liberate_pong(-p: pong) -> ::pipes::send_packet<ping> {
let
addr
:
*
::
pipes
::
send_packet
<
ping
>
=
match
&
p
{
&
pong
(
ref
x
)
=>
{
cast
::
transmute
(
ptr
::
addr_of
(
x
))
}
};
let
liberated_value
=
move
*
addr
;
cast
::
forget
(
move
p
);
move
liberated_value
let
liberated_value
=
*
addr
;
cast
::
forget
(
p
);
liberated_value
}
}
...
...
@@ -262,16 +262,16 @@ pub mod client {
pub
fn
do_ping
(
-
c
:
ping
)
->
pong
{
let
(
sp
,
rp
)
=
::
pipes
::
entangle
();
::
pipes
::
send
(
move
c
,
pingpong
::
ping
(
move
sp
));
move
rp
::
pipes
::
send
(
c
,
pingpong
::
ping
(
sp
));
rp
}
pub
fn
do_pong
(
-
c
:
pong
)
->
(
ping
,
())
{
let
packet
=
::
pipes
::
recv
(
move
c
);
let
packet
=
::
pipes
::
recv
(
c
);
if
packet
.is_none
()
{
fail
!
(
~
"sender closed the connection"
)
}
(
pingpong
::
liberate_pong
(
option
::
unwrap
(
move
packet
)),
())
(
pingpong
::
liberate_pong
(
option
::
unwrap
(
packet
)),
())
}
}
...
...
@@ -282,32 +282,32 @@ pub mod server {
pub
type
pong
=
::
pipes
::
send_packet
<
pingpong
::
pong
>
;
pub
fn
do_ping
(
-
c
:
ping
)
->
(
pong
,
())
{
let
packet
=
::
pipes
::
recv
(
move
c
);
let
packet
=
::
pipes
::
recv
(
c
);
if
packet
.is_none
()
{
fail
!
(
~
"sender closed the connection"
)
}
(
pingpong
::
liberate_ping
(
option
::
unwrap
(
move
packet
)),
())
(
pingpong
::
liberate_ping
(
option
::
unwrap
(
packet
)),
())
}
pub
fn
do_pong
(
-
c
:
pong
)
->
ping
{
let
(
sp
,
rp
)
=
::
pipes
::
entangle
();
::
pipes
::
send
(
move
c
,
pingpong
::
pong
(
move
sp
));
move
rp
::
pipes
::
send
(
c
,
pingpong
::
pong
(
sp
));
rp
}
}
}
fn
client
(
-
chan
:
pingpong
::
client
::
ping
)
{
let
chan
=
pingpong
::
client
::
do_ping
(
move
chan
);
let
chan
=
pingpong
::
client
::
do_ping
(
chan
);
log
(
error
,
~
"Sent ping"
);
let
(
_
chan
,
_
data
)
=
pingpong
::
client
::
do_pong
(
move
chan
);
let
(
_
chan
,
_
data
)
=
pingpong
::
client
::
do_pong
(
chan
);
log
(
error
,
~
"Received pong"
);
}
fn
server
(
-
chan
:
pingpong
::
server
::
ping
)
{
let
(
chan
,
_
data
)
=
pingpong
::
server
::
do_ping
(
move
chan
);
let
(
chan
,
_
data
)
=
pingpong
::
server
::
do_ping
(
chan
);
log
(
error
,
~
"Received ping"
);
let
_
chan
=
pingpong
::
server
::
do_pong
(
move
chan
);
let
_
chan
=
pingpong
::
server
::
do_pong
(
chan
);
log
(
error
,
~
"Sent pong"
);
}
...
...
@@ -319,12 +319,12 @@ pub fn main() {
let client_ = ~mut Some(client_);
let server_ = ~mut Some(server_);
task::spawn {|
move
client_|
task::spawn {|client_|
let mut client__ = none;
*client_ <-> client__;
client(option::unwrap(client__));
};
task::spawn {|
move
server_|
task::spawn {|server_|
let mut server_ˊ = none;
*server_ <-> server_ˊ;
server(option::unwrap(server_ˊ));
...
...
src/test/run-pass/issue-2834.rs
浏览文件 @
178882c9
...
...
@@ -19,7 +19,7 @@
fn
rendezvous
()
{
let
(
c
,
s
)
=
streamp
::
init
();
let
streams
:
~
[
streamp
::
client
::
open
<
int
>
]
=
~
[
move
c
];
let
streams
:
~
[
streamp
::
client
::
open
<
int
>
]
=
~
[
c
];
error!
(
"%?"
,
streams
[
0
]);
}
...
...
src/test/run-pass/issue-2904.rs
浏览文件 @
178882c9
...
...
@@ -60,7 +60,7 @@ fn square_from_char(c: char) -> square {
}
fn
read_board_grid
<
rdr
:
&
static
io
::
Reader
>
(
+
in
:
rdr
)
->
~
[
~
[
square
]]
{
let
in
=
(
move
in
)
as
io
::
Reader
;
let
in
=
(
in
)
as
io
::
Reader
;
let
mut
grid
=
~
[];
for
in
.each_line
|
line
|
{
let
mut
row
=
~
[];
...
...
src/test/run-pass/issue-2930.rs
浏览文件 @
178882c9
...
...
@@ -17,5 +17,5 @@
pub
fn
main
()
{
let
(
bc
,
_
bp
)
=
stream
::
init
();
stream
::
client
::
send
(
move
bc
,
~
"abc"
);
stream
::
client
::
send
(
bc
,
~
"abc"
);
}
src/test/run-pass/issue-3168.rs
浏览文件 @
178882c9
...
...
@@ -12,15 +12,15 @@
pub
fn
main
()
{
let
(
p
,
c
)
=
pipes
::
stream
();
do
task
::
try
|
move
c
|
{
do
task
::
try
||
{
let
(
p2
,
c2
)
=
pipes
::
stream
();
do
task
::
spawn
|
move
p2
|
{
do
task
::
spawn
||
{
p2
.recv
();
error!
(
"sibling fails"
);
fail
!
();
}
let
(
p3
,
c3
)
=
pipes
::
stream
();
c
.send
(
move
c3
);
c
.send
(
c3
);
c2
.send
(());
error!
(
"child blocks"
);
p3
.recv
();
...
...
src/test/run-pass/issue-3176.rs
浏览文件 @
178882c9
...
...
@@ -14,19 +14,19 @@
pub
fn
main
()
{
let
(
p
,
c
)
=
pipes
::
stream
();
do
task
::
try
|
move
c
|
{
do
task
::
try
||
{
let
(
p2
,
c2
)
=
pipes
::
stream
();
do
task
::
spawn
|
move
p2
|
{
do
task
::
spawn
||
{
p2
.recv
();
error!
(
"sibling fails"
);
fail
!
();
}
let
(
p3
,
c3
)
=
pipes
::
stream
();
c
.send
(
move
c3
);
c
.send
(
c3
);
c2
.send
(());
error!
(
"child blocks"
);
let
(
p
,
c
)
=
pipes
::
stream
();
(
move
p
,
move
p3
)
.select
();
(
p
,
p3
)
.select
();
c
.send
(());
};
error!
(
"parent tries"
);
...
...
src/test/run-pass/issue-3220.rs
浏览文件 @
178882c9
...
...
@@ -23,5 +23,5 @@ impl thing { fn f(self) {} }
pub
fn
main
()
{
let
z
=
thing
();
(
move
z
)
.f
();
(
z
)
.f
();
}
src/test/run-pass/issue-3447.rs
浏览文件 @
178882c9
...
...
@@ -20,7 +20,7 @@ fn addEnd(&self, element: &self/T) {
next
:
option
::
None
};
self
.next
=
Some
(
@
(
move
newList
));
self
.next
=
Some
(
@
(
newList
));
}
}
...
...
src/test/run-pass/issue-3878.rs
浏览文件 @
178882c9
...
...
@@ -11,5 +11,5 @@
pub
fn
main
()
{
let
y
=
~
1
;
move
y
;
y
;
}
src/test/run-pass/issue-4016.rs
浏览文件 @
178882c9
...
...
@@ -20,7 +20,7 @@ trait JD : Deserializable<json::Deserializer> { }
fn
exec
<
T
:
JD
>
()
{
let
doc
=
result
::
unwrap
(
json
::
from_str
(
""
));
let
_
v
:
T
=
deserialize
(
&
json
::
Deserializer
(
move
doc
));
let
_
v
:
T
=
deserialize
(
&
json
::
Deserializer
(
doc
));
fail
!
()
}
...
...
src/test/run-pass/last-use-in-block.rs
浏览文件 @
178882c9
...
...
@@ -13,14 +13,14 @@
fn
lp
<
T
>
(
s
:
~
str
,
f
:
fn
(
~
str
)
->
T
)
->
T
{
while
false
{
let
r
=
f
(
s
);
return
(
move
r
);
return
(
r
);
}
fail
!
();
}
fn
apply
<
T
>
(
s
:
~
str
,
f
:
fn
(
~
str
)
->
T
)
->
T
{
fn
g
<
T
>
(
s
:
~
str
,
f
:
fn
(
~
str
)
->
T
)
->
T
{
f
(
s
)}
g
(
s
,
|
v
|
{
let
r
=
f
(
v
);
move
r
})
g
(
s
,
|
v
|
{
let
r
=
f
(
v
);
r
})
}
pub
fn
main
()
{}
src/test/run-pass/last-use-in-cap-clause.rs
浏览文件 @
178882c9
...
...
@@ -15,7 +15,7 @@ struct A { a: ~int }
fn
foo
()
->
fn
@
()
->
int
{
let
k
=
~
22
;
let
_u
=
A
{
a
:
copy
k
};
return
fn
@
(
move
k
)
->
int
{
22
};
return
fn
@
()
->
int
{
22
};
}
pub
fn
main
()
{
...
...
src/test/run-pass/liveness-move-in-loop.rs
浏览文件 @
178882c9
...
...
@@ -15,7 +15,7 @@ fn the_loop() {
loop
{
let
x
=
5
;
if
x
>
3
{
list
+=
~
[
take
(
move
x
)];
list
+=
~
[
take
(
x
)];
}
else
{
break
;
}
...
...
src/test/run-pass/log-linearized.rs
浏览文件 @
178882c9
...
...
@@ -21,7 +21,7 @@ struct V<T> { v: ~[option<T>] }
fn
mk
<
T
>
()
->
@
Smallintmap
<
T
>
{
let
mut
v
:
~
[
option
<
T
>
]
=
~
[];
return
@
Smallintmap
{
mut
v
:
move
v
};
return
@
Smallintmap
{
mut
v
:
v
};
}
fn
f
<
T
,
U
>
()
{
...
...
src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs
浏览文件 @
178882c9
...
...
@@ -25,7 +25,7 @@ struct F<A> { a: A }
impl
<
A
:
Copy
Serializable
>
Serializable
for
F
<
A
>
{
fn
serialize
<
S
:
Serializer
>
(
s
:
S
)
{
self
.a
.serialize
(
move
s
);
self
.a
.serialize
(
s
);
}
}
...
...
src/test/run-pass/move-1-unique.rs
浏览文件 @
178882c9
...
...
@@ -13,7 +13,7 @@ struct Triple { x: int, y: int, z: int }
fn
test
(
x
:
bool
,
foo
:
~
Triple
)
->
int
{
let
bar
=
foo
;
let
mut
y
:
~
Triple
;
if
x
{
y
=
move
bar
;
}
else
{
y
=
~
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
if
x
{
y
=
bar
;
}
else
{
y
=
~
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
return
y
.y
;
}
...
...
src/test/run-pass/move-1.rs
浏览文件 @
178882c9
...
...
@@ -13,7 +13,7 @@ struct Triple { x: int, y: int, z: int }
fn
test
(
x
:
bool
,
foo
:
@
Triple
)
->
int
{
let
bar
=
foo
;
let
mut
y
:
@
Triple
;
if
x
{
y
=
move
bar
;
}
else
{
y
=
@
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
if
x
{
y
=
bar
;
}
else
{
y
=
@
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
return
y
.y
;
}
...
...
src/test/run-pass/move-2-unique.rs
浏览文件 @
178882c9
...
...
@@ -11,4 +11,4 @@
struct
X
{
x
:
int
,
y
:
int
,
z
:
int
}
pub
fn
main
()
{
let
x
=
~
X
{
x
:
1
,
y
:
2
,
z
:
3
};
let
y
=
move
x
;
assert
(
y
.y
==
2
);
}
pub
fn
main
()
{
let
x
=
~
X
{
x
:
1
,
y
:
2
,
z
:
3
};
let
y
=
x
;
assert
(
y
.y
==
2
);
}
src/test/run-pass/move-2.rs
浏览文件 @
178882c9
...
...
@@ -11,4 +11,4 @@
struct
X
{
x
:
int
,
y
:
int
,
z
:
int
}
pub
fn
main
()
{
let
x
=
@
X
{
x
:
1
,
y
:
2
,
z
:
3
};
let
y
=
move
x
;
assert
(
y
.y
==
2
);
}
pub
fn
main
()
{
let
x
=
@
X
{
x
:
1
,
y
:
2
,
z
:
3
};
let
y
=
x
;
assert
(
y
.y
==
2
);
}
src/test/run-pass/move-3-unique.rs
浏览文件 @
178882c9
...
...
@@ -15,7 +15,7 @@ struct Triple { x: int, y: int, z: int }
fn
test
(
x
:
bool
,
foo
:
~
Triple
)
->
int
{
let
bar
=
foo
;
let
mut
y
:
~
Triple
;
if
x
{
y
=
move
bar
;
}
else
{
y
=
~
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
if
x
{
y
=
bar
;
}
else
{
y
=
~
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
return
y
.y
;
}
...
...
src/test/run-pass/move-3.rs
浏览文件 @
178882c9
...
...
@@ -15,7 +15,7 @@ struct Triple { x: int, y: int, z: int }
fn
test
(
x
:
bool
,
foo
:
@
Triple
)
->
int
{
let
bar
=
foo
;
let
mut
y
:
@
Triple
;
if
x
{
y
=
move
bar
;
}
else
{
y
=
@
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
if
x
{
y
=
bar
;
}
else
{
y
=
@
Triple
{
x
:
4
,
y
:
5
,
z
:
6
};
}
return
y
.y
;
}
...
...
src/test/run-pass/move-4-unique.rs
浏览文件 @
178882c9
...
...
@@ -14,9 +14,9 @@ struct Triple {a: int, b: int, c: int}
fn
test
(
foo
:
~
Triple
)
->
~
Triple
{
let
foo
=
foo
;
let
bar
=
move
foo
;
let
baz
=
move
bar
;
let
quux
=
move
baz
;
let
bar
=
foo
;
let
baz
=
bar
;
let
quux
=
baz
;
return
quux
;
}
...
...
src/test/run-pass/move-4.rs
浏览文件 @
178882c9
...
...
@@ -15,9 +15,9 @@ struct Triple { a: int, b: int, c: int }
fn
test
(
foo
:
@
Triple
)
->
@
Triple
{
let
foo
=
foo
;
let
bar
=
move
foo
;
let
baz
=
move
bar
;
let
quux
=
move
baz
;
let
bar
=
foo
;
let
baz
=
bar
;
let
quux
=
baz
;
return
quux
;
}
...
...
src/test/run-pass/move-arg-2-unique.rs
浏览文件 @
178882c9
...
...
@@ -13,7 +13,7 @@
pub
fn
main
()
{
let
x
=
~~
[
10
];
// Test forgetting a local by move-in
test
(
move
x
);
test
(
x
);
// Test forgetting a temporary by move-in.
test
(
~~
[
10
]);
...
...
src/test/run-pass/move-arg-2.rs
浏览文件 @
178882c9
...
...
@@ -13,7 +13,7 @@
pub
fn
main
()
{
let
x
=
@~
[
10
];
// Test forgetting a local by move-in
test
(
move
x
);
test
(
x
);
// Test forgetting a temporary by move-in.
test
(
@~
[
10
]);
...
...
src/test/run-pass/move-arg.rs
浏览文件 @
178882c9
...
...
@@ -10,4 +10,4 @@
fn
test
(
-
foo
:
int
)
{
assert
(
foo
==
10
);
}
pub
fn
main
()
{
let
x
=
10
;
test
(
move
x
);
}
pub
fn
main
()
{
let
x
=
10
;
test
(
x
);
}
src/test/run-pass/move-nullary-fn.rs
浏览文件 @
178882c9
...
...
@@ -12,7 +12,7 @@
fn
f2
(
-
thing
:
fn
@
())
{
}
fn
f
(
-
thing
:
fn
@
())
{
f2
(
move
thing
);
f2
(
thing
);
}
pub
fn
main
()
{
...
...
src/test/run-pass/move-scalar.rs
浏览文件 @
178882c9
...
...
@@ -12,6 +12,6 @@ pub fn main() {
let
y
:
int
=
42
;
let
mut
x
:
int
;
x
=
move
y
;
x
=
y
;
assert
(
x
==
42
);
}
src/test/run-pass/move-self.rs
浏览文件 @
178882c9
...
...
@@ -4,7 +4,7 @@ struct S {
impl
S
{
fn
foo
(
self
)
{
(
move
self
)
.bar
();
self
.bar
();
}
fn
bar
(
self
)
{
...
...
src/test/run-pass/non-legacy-modes.rs
浏览文件 @
178882c9
...
...
@@ -13,7 +13,7 @@ struct X {
}
fn
apply
<
T
>
(
x
:
T
,
f
:
fn
(
T
))
{
f
(
move
x
);
f
(
x
);
}
fn
check_int
(
x
:
int
)
{
...
...
src/test/run-pass/option-unwrap.rs
浏览文件 @
178882c9
...
...
@@ -21,8 +21,8 @@ fn finalize(&self) {
}
fn
unwrap
<
T
>
(
+
o
:
Option
<
T
>
)
->
T
{
match
move
o
{
Some
(
move
v
)
=>
move
v
,
match
o
{
Some
(
v
)
=>
v
,
None
=>
fail
!
()
}
}
...
...
@@ -32,7 +32,7 @@ pub fn main() {
{
let
b
=
Some
(
dtor
{
x
:
x
});
let
c
=
unwrap
(
move
b
);
let
c
=
unwrap
(
b
);
}
assert
*
x
==
0
;
...
...
src/test/run-pass/pipe-bank-proto.rs
浏览文件 @
178882c9
...
...
@@ -44,21 +44,21 @@
)
macro_rules!
move_it
(
{
$x:expr
}
=>
{
unsafe
{
let
y
=
move
*
ptr
::
addr_of
(
&
(
$x
));
move
y
}
}
{
$x:expr
}
=>
{
unsafe
{
let
y
=
*
ptr
::
addr_of
(
&
(
$x
));
y
}
}
)
fn
switch
<
T
:
Owned
,
U
>
(
+
endp
:
pipes
::
RecvPacket
<
T
>
,
f
:
fn
(
+
v
:
Option
<
T
>
)
->
U
)
->
U
{
f
(
pipes
::
try_recv
(
move
endp
))
f
(
pipes
::
try_recv
(
endp
))
}
fn
move_it
<
T
>
(
-
x
:
T
)
->
T
{
move
x
}
fn
move_it
<
T
>
(
-
x
:
T
)
->
T
{
x
}
macro_rules!
follow
(
{
$
(
$message:path$
((
$
(
$x
:
ident
),
+
))||
*
->
$next:ident
$e:expr
)
+
}
=>
(
|
m
|
match
m
ove
m
{
|
m
|
match
m
{
$
(
Some
(
$message
(
$
(
$
(
$x
,)
+
)
*
next
))
=>
{
let
$next
=
move_it!
(
next
);
$e
})
+
...
...
@@ -70,15 +70,15 @@ fn move_it<T>(-x: T) -> T { move x }
fn
client_follow
(
+
bank
:
bank
::
client
::
login
)
{
use
bank
::
*
;
let
bank
=
client
::
login
(
move
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
switch
(
move
bank
,
follow!
(
ok
->
connected
{
move
connected
}
let
bank
=
client
::
login
(
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
switch
(
bank
,
follow!
(
ok
->
connected
{
connected
}
invalid
->
_
next
{
fail!
(
~
"bank closed the connected"
)
}
));
let
bank
=
client
::
deposit
(
move
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
move
bank
,
50.00
);
switch
(
move
bank
,
follow!
(
let
bank
=
client
::
deposit
(
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
bank
,
50.00
);
switch
(
bank
,
follow!
(
money
(
m
)
->
_
next
{
io
::
println
(
~
"Yay! I got money!"
);
}
...
...
@@ -91,8 +91,8 @@ fn client_follow(+bank: bank::client::login) {
fn
bank_client
(
+
bank
:
bank
::
client
::
login
)
{
use
bank
::
*
;
let
bank
=
client
::
login
(
move
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
match
try_recv
(
move
bank
)
{
let
bank
=
client
::
login
(
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
match
try_recv
(
bank
)
{
Some
(
ok
(
connected
))
=>
{
move_it!
(
connected
)
}
...
...
@@ -100,9 +100,9 @@ fn bank_client(+bank: bank::client::login) {
None
=>
{
fail
!
(
~
"bank closed the connection"
)
}
};
let
bank
=
client
::
deposit
(
move
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
move
bank
,
50.00
);
match
try_recv
(
move
bank
)
{
let
bank
=
client
::
deposit
(
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
bank
,
50.00
);
match
try_recv
(
bank
)
{
Some
(
money
(
*
))
=>
{
io
::
println
(
~
"Yay! I got money!"
);
}
...
...
src/test/run-pass/pipe-detect-term.rs
浏览文件 @
178882c9
...
...
@@ -32,7 +32,7 @@ pub fn main() {
let
iotask
=
&
uv
::
global_loop
::
get
();
pipes
::
spawn_service
(
oneshot
::
init
,
|
p
|
{
match
try_recv
(
move
p
)
{
match
try_recv
(
p
)
{
Some
(
*
)
=>
{
fail
!
()
}
None
=>
{
}
}
...
...
@@ -47,11 +47,11 @@ pub fn main() {
fn
failtest
()
{
let
(
c
,
p
)
=
oneshot
::
init
();
do
task
::
spawn_with
(
move
c
)
|
_
c
|
{
do
task
::
spawn_with
(
c
)
|
_
c
|
{
fail
!
();
}
error!
(
"%?"
,
recv
(
move
p
));
error!
(
"%?"
,
recv
(
p
));
// make sure we get killed if we missed it in the receive.
loop
{
task
::
yield
()
}
}
src/test/run-pass/pipe-peek.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/pipe-pingpong-bounded.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/pipe-pingpong-proto.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/pipe-presentation-examples.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/pipe-select.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/pipe-sleep.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/regions-copy-closure.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/regions-static-closure.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/resource-assign-is-not-copy.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/resource-cycle.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/resource-cycle2.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/resource-cycle3.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/resource-destruct.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/resource-generic.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/rt-sched-1.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/select-macro.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/sendfn-spawn-with-fn-arg.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/static-method-test.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-0.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-10.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-11.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-12.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-13.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-14.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-15.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-16.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-3.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-7.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/task-comm-9.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/trait-default-method-bound-subst.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/trait-default-method-bound-subst2.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/trait-default-method-bound-subst3.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/trait-default-method-bound-subst4.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/trait-to-str.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unique-decl-move-temp.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unique-decl-move.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unique-fn-arg-move.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unique-move-drop.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unique-move-temp.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unique-move.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unreachable-code-1.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unreachable-code.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unused-move-capture.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unused-move.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unwind-resource.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/unwind-resource2.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/weird-exprs.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/while-loop-constraints-2.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/yield.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
src/test/run-pass/yield1.rs
浏览文件 @
178882c9
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录