Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3ebd878f
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,发现更多精彩内容 >>
提交
3ebd878f
编写于
9月 18, 2012
作者:
T
Tim Chevalier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make moves explicit in rpass tests
上级
21453480
变更
59
隐藏空白更改
内联
并排
Showing
59 changed file
with
192 addition
and
185 deletion
+192
-185
src/test/run-pass/argument-passing.rs
src/test/run-pass/argument-passing.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/fn-bare-spawn.rs
src/test/run-pass/fn-bare-spawn.rs
+1
-1
src/test/run-pass/functional-struct-update.rs
src/test/run-pass/functional-struct-update.rs
+1
-1
src/test/run-pass/intrinsic-move-val.rs
src/test/run-pass/intrinsic-move-val.rs
+1
-1
src/test/run-pass/issue-2185.rs
src/test/run-pass/issue-2185.rs
+1
-1
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2718.rs
+31
-29
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
+4
-4
src/test/run-pass/issue-3176.rs
src/test/run-pass/issue-3176.rs
+5
-5
src/test/run-pass/issue-3668.rs
src/test/run-pass/issue-3668.rs
+1
-0
src/test/run-pass/issue-3688-2.rs
src/test/run-pass/issue-3688-2.rs
+4
-3
src/test/run-pass/last-use-corner-cases.rs
src/test/run-pass/last-use-corner-cases.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/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-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/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
+2
-2
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
+15
-15
src/test/run-pass/pipe-pingpong-proto.rs
src/test/run-pass/pipe-pingpong-proto.rs
+8
-8
src/test/run-pass/pipe-presentation-examples.rs
src/test/run-pass/pipe-presentation-examples.rs
+9
-9
src/test/run-pass/pipe-select-macro.rs
src/test/run-pass/pipe-select-macro.rs
+2
-0
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
+2
-2
src/test/run-pass/regions-static-closure.rs
src/test/run-pass/regions-static-closure.rs
+3
-3
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/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
+6
-6
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
-2
src/test/run-pass/task-comm.rs
src/test/run-pass/task-comm.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-fn-arg-move.rs
src/test/run-pass/unique-fn-arg-move.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
未找到文件。
src/test/run-pass/argument-passing.rs
浏览文件 @
3ebd878f
...
...
@@ -12,7 +12,7 @@ fn f1(a: {mut x: int}, b: &mut int, -c: int) -> int {
fn
main
()
{
let
mut
a
=
{
mut
x
:
1
},
b
=
2
,
c
=
3
;
assert
(
f1
(
a
,
&
mut
b
,
c
)
==
6
);
assert
(
f1
(
a
,
&
mut
b
,
move
c
)
==
6
);
assert
(
a
.x
==
0
);
assert
(
b
==
10
);
assert
(
f2
(
a
.x
,
|
x
|
a
.x
=
50
)
==
0
);
...
...
src/test/run-pass/auto-ref-sliceable.rs
浏览文件 @
3ebd878f
...
...
@@ -4,7 +4,7 @@ trait Pushable<T> {
impl
<
T
>
~
[
T
]:
Pushable
<
T
>
{
fn
push_val
(
&
mut
self
,
+
t
:
T
)
{
self
.push
(
t
);
self
.push
(
move
t
);
}
}
...
...
src/test/run-pass/fn-bare-spawn.rs
浏览文件 @
3ebd878f
// This is what the signature to spawn should look like with bare functions
fn
spawn
<
T
:
Send
>
(
val
:
T
,
f
:
extern
fn
(
T
))
{
f
(
val
);
f
(
move
val
);
}
fn
f
(
+
i
:
int
)
{
...
...
src/test/run-pass/functional-struct-update.rs
浏览文件 @
3ebd878f
...
...
@@ -5,7 +5,7 @@ struct Foo {
fn
main
()
{
let
a
=
Foo
{
x
:
1
,
y
:
2
};
let
c
=
Foo
{
x
:
4
,
..
a
};
let
c
=
Foo
{
x
:
4
,
..
a
};
io
::
println
(
fmt!
(
"%?"
,
c
));
}
src/test/run-pass/intrinsic-move-val.rs
浏览文件 @
3ebd878f
...
...
@@ -8,6 +8,6 @@
fn
main
()
{
let
mut
x
=
@
1
;
let
mut
y
=
@
2
;
rusti
::
move_val
(
&
mut
y
,
x
);
rusti
::
move_val
(
&
mut
y
,
move
x
);
assert
*
y
==
1
;
}
\ No newline at end of file
src/test/run-pass/issue-2185.rs
浏览文件 @
3ebd878f
...
...
@@ -28,7 +28,7 @@ fn foldl<A,B,IA:iterable<A>>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B {
do
self
.iter
|
a
|
{
b
<-
blk
(
b
,
a
);
}
return
b
;
move
b
}
fn
range
(
lo
:
uint
,
hi
:
uint
,
it
:
fn
(
uint
))
{
...
...
src/test/run-pass/issue-2718.rs
浏览文件 @
3ebd878f
// tjc: I don't know why
// xfail-pretty
mod
pipes
{
#[legacy_exports]
;
use
cast
::{
forget
,
transmute
};
...
...
@@ -42,18 +44,18 @@ mod rusti {
// We should consider moving this to core::unsafe, although I
// suspect graydon would want us to use void pointers instead.
unsafe
fn
uniquify
<
T
>
(
+
x
:
*
T
)
->
~
T
{
unsafe
{
cast
::
transmute
(
x
)
}
unsafe
{
cast
::
transmute
(
move
x
)
}
}
fn
swap_state_acq
(
+
dst
:
&
mut
state
,
src
:
state
)
->
state
{
unsafe
{
transmute
(
rusti
::
atomic_xchg_acq
(
transmute
(
dst
),
src
as
int
))
transmute
(
rusti
::
atomic_xchg_acq
(
transmute
(
move
dst
),
src
as
int
))
}
}
fn
swap_state_rel
(
+
dst
:
&
mut
state
,
src
:
state
)
->
state
{
unsafe
{
transmute
(
rusti
::
atomic_xchg_rel
(
transmute
(
dst
),
src
as
int
))
transmute
(
rusti
::
atomic_xchg_rel
(
transmute
(
move
dst
),
src
as
int
))
}
}
...
...
@@ -61,20 +63,20 @@ fn send<T: Send>(-p: send_packet<T>, -payload: T) {
let
p
=
p
.unwrap
();
let
p
=
unsafe
{
uniquify
(
p
)
};
assert
(
*
p
)
.payload
.is_none
();
(
*
p
)
.payload
<-
Some
(
payload
);
(
*
p
)
.payload
<-
Some
(
move
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
(
p
);
}
unsafe
{
forget
(
move
p
);
}
}
full
=>
{
fail
~
"duplicate send"
}
blocked
=>
{
// The receiver will eventually clean this up.
unsafe
{
forget
(
p
);
}
unsafe
{
forget
(
move
p
);
}
}
terminated
=>
{
// The receiver will never receive this. Rely on drop_glue
...
...
@@ -94,7 +96,7 @@ fn recv<T: Send>(-p: recv_packet<T>) -> Option<T> {
full
=>
{
let
mut
payload
=
None
;
payload
<->
(
*
p
)
.payload
;
return
Some
(
option
::
unwrap
(
payload
))
return
Some
(
option
::
unwrap
(
move
payload
))
}
terminated
=>
{
assert
old_state
==
terminated
;
...
...
@@ -109,7 +111,7 @@ fn sender_terminate<T: Send>(p: *packet<T>) {
match
swap_state_rel
(
&
mut
(
*
p
)
.state
,
terminated
)
{
empty
|
blocked
=>
{
// The receiver will eventually clean up.
unsafe
{
forget
(
p
)
}
unsafe
{
forget
(
move
p
)
}
}
full
=>
{
// This is impossible
...
...
@@ -126,7 +128,7 @@ fn receiver_terminate<T: Send>(p: *packet<T>) {
match
swap_state_rel
(
&
mut
(
*
p
)
.state
,
terminated
)
{
empty
=>
{
// the sender will clean up
unsafe
{
forget
(
p
)
}
unsafe
{
forget
(
move
p
)
}
}
blocked
=>
{
// this shouldn't happen.
...
...
@@ -144,7 +146,7 @@ struct send_packet<T: Send> {
if
self
.p
!=
None
{
let
mut
p
=
None
;
p
<->
self
.p
;
sender_terminate
(
option
::
unwrap
(
p
))
sender_terminate
(
option
::
unwrap
(
move
p
))
}
}
}
...
...
@@ -153,7 +155,7 @@ impl<T: Send> send_packet<T> {
fn
unwrap
()
->
*
packet
<
T
>
{
let
mut
p
=
None
;
p
<->
self
.p
;
option
::
unwrap
(
p
)
option
::
unwrap
(
move
p
)
}
}
...
...
@@ -169,7 +171,7 @@ struct recv_packet<T: Send> {
if
self
.p
!=
None
{
let
mut
p
=
None
;
p
<->
self
.p
;
receiver_terminate
(
option
::
unwrap
(
p
))
receiver_terminate
(
option
::
unwrap
(
move
p
))
}
}
}
...
...
@@ -178,7 +180,7 @@ impl<T: Send> recv_packet<T> {
fn
unwrap
()
->
*
packet
<
T
>
{
let
mut
p
=
None
;
p
<->
self
.p
;
option
::
unwrap
(
p
)
option
::
unwrap
(
move
p
)
}
}
...
...
@@ -204,8 +206,8 @@ fn liberate_ping(-p: ping) -> pipes::send_packet<pong> unsafe {
ping
(
x
)
=>
{
cast
::
transmute
(
ptr
::
addr_of
(
&
x
))
}
};
let
liberated_value
<-
*
addr
;
cast
::
forget
(
p
);
liberated_value
cast
::
forget
(
move
p
);
move
liberated_value
}
fn
liberate_pong
(
-
p
:
pong
)
->
pipes
::
send_packet
<
ping
>
unsafe
{
...
...
@@ -213,8 +215,8 @@ fn liberate_pong(-p: pong) -> pipes::send_packet<ping> unsafe {
pong
(
x
)
=>
{
cast
::
transmute
(
ptr
::
addr_of
(
&
x
))
}
};
let
liberated_value
<-
*
addr
;
cast
::
forget
(
p
);
liberated_value
cast
::
forget
(
move
p
);
move
liberated_value
}
fn
init
()
->
(
client
::
ping
,
server
::
ping
)
{
...
...
@@ -229,16 +231,16 @@ mod client {
fn
do_ping
(
-
c
:
ping
)
->
pong
{
let
(
sp
,
rp
)
=
pipes
::
entangle
();
pipes
::
send
(
c
,
ping
(
sp
));
rp
pipes
::
send
(
move
c
,
ping
(
move
sp
));
move
rp
}
fn
do_pong
(
-
c
:
pong
)
->
(
ping
,
())
{
let
packet
=
pipes
::
recv
(
c
);
let
packet
=
pipes
::
recv
(
move
c
);
if
packet
.is_none
()
{
fail
~
"sender closed the connection"
}
(
liberate_pong
(
option
::
unwrap
(
packet
)),
())
(
liberate_pong
(
option
::
unwrap
(
move
packet
)),
())
}
}
...
...
@@ -248,32 +250,32 @@ mod server {
type
pong
=
pipes
::
send_packet
<
pingpong
::
pong
>
;
fn
do_ping
(
-
c
:
ping
)
->
(
pong
,
())
{
let
packet
=
pipes
::
recv
(
c
);
let
packet
=
pipes
::
recv
(
move
c
);
if
packet
.is_none
()
{
fail
~
"sender closed the connection"
}
(
liberate_ping
(
option
::
unwrap
(
packet
)),
())
(
liberate_ping
(
option
::
unwrap
(
move
packet
)),
())
}
fn
do_pong
(
-
c
:
pong
)
->
ping
{
let
(
sp
,
rp
)
=
pipes
::
entangle
();
pipes
::
send
(
c
,
pong
(
sp
));
rp
pipes
::
send
(
move
c
,
pong
(
move
sp
));
move
rp
}
}
}
fn
client
(
-
chan
:
pingpong
::
client
::
ping
)
{
let
chan
=
pingpong
::
client
::
do_ping
(
chan
);
let
chan
=
pingpong
::
client
::
do_ping
(
move
chan
);
log
(
error
,
~
"Sent ping"
);
let
(
chan
,
_
data
)
=
pingpong
::
client
::
do_pong
(
chan
);
let
(
_
chan
,
_
data
)
=
pingpong
::
client
::
do_pong
(
move
chan
);
log
(
error
,
~
"Received pong"
);
}
fn
server
(
-
chan
:
pingpong
::
server
::
ping
)
{
let
(
chan
,
_
data
)
=
pingpong
::
server
::
do_ping
(
chan
);
let
(
chan
,
_
data
)
=
pingpong
::
server
::
do_ping
(
move
chan
);
log
(
error
,
~
"Received ping"
);
let
chan
=
pingpong
::
server
::
do_pong
(
chan
);
let
_
chan
=
pingpong
::
server
::
do_pong
(
move
chan
);
log
(
error
,
~
"Sent pong"
);
}
...
...
src/test/run-pass/issue-2834.rs
浏览文件 @
3ebd878f
...
...
@@ -9,7 +9,7 @@
fn
rendezvous
()
{
let
(
c
,
s
)
=
streamp
::
init
();
let
streams
:
~
[
streamp
::
client
::
open
<
int
>
]
=
~
[
c
];
let
streams
:
~
[
streamp
::
client
::
open
<
int
>
]
=
~
[
move
c
];
error!
(
"%?"
,
streams
[
0
]);
}
...
...
src/test/run-pass/issue-2904.rs
浏览文件 @
3ebd878f
...
...
@@ -48,7 +48,7 @@ fn square_from_char(c: char) -> square {
}
fn
read_board_grid
<
rdr
:
Owned
io
::
Reader
>
(
+
in
:
rdr
)
->
~
[
~
[
square
]]
{
let
in
=
in
as
io
::
Reader
;
let
in
=
(
move
in
)
as
io
::
Reader
;
let
mut
grid
=
~
[];
for
in
.each_line
|
line
|
{
let
mut
row
=
~
[];
...
...
src/test/run-pass/issue-2930.rs
浏览文件 @
3ebd878f
...
...
@@ -7,5 +7,5 @@
fn
main
()
{
let
(
bc
,
_
bp
)
=
stream
::
init
();
stream
::
client
::
send
(
bc
,
~
"abc"
);
stream
::
client
::
send
(
move
bc
,
~
"abc"
);
}
src/test/run-pass/issue-3168.rs
浏览文件 @
3ebd878f
...
...
@@ -2,15 +2,15 @@
fn
main
()
{
let
(
c
,
p
)
=
pipes
::
stream
();
do
task
::
try
{
do
task
::
try
|
move
c
|
{
let
(
c2
,
p2
)
=
pipes
::
stream
();
do
task
::
spawn
{
do
task
::
spawn
|
move
p2
|
{
p2
.recv
();
error!
(
"
brother
fails"
);
error!
(
"
sibling
fails"
);
fail
;
}
let
(
c3
,
p3
)
=
pipes
::
stream
();
c
.send
(
c3
);
c
.send
(
move
c3
);
c2
.send
(());
error!
(
"child blocks"
);
p3
.recv
();
...
...
src/test/run-pass/issue-3176.rs
浏览文件 @
3ebd878f
...
...
@@ -4,19 +4,19 @@
fn
main
()
{
let
(
c
,
p
)
=
pipes
::
stream
();
do
task
::
try
{
do
task
::
try
|
move
c
|
{
let
(
c2
,
p2
)
=
pipes
::
stream
();
do
task
::
spawn
{
do
task
::
spawn
|
move
p2
|
{
p2
.recv
();
error!
(
"
brother
fails"
);
error!
(
"
sibling
fails"
);
fail
;
}
let
(
c3
,
p3
)
=
pipes
::
stream
();
c
.send
(
c3
);
c
.send
(
move
c3
);
c2
.send
(());
error!
(
"child blocks"
);
let
(
c
,
p
)
=
pipes
::
stream
();
(
p
,
p3
)
.select
();
(
move
p
,
move
p3
)
.select
();
c
.send
(());
};
error!
(
"parent tries"
);
...
...
src/test/run-pass/issue-3668.rs
浏览文件 @
3ebd878f
// xfail-test
struct
P
{
child
:
Option
<@
mut
P
>
}
trait
PTrait
{
fn
getChildOption
()
->
Option
<@
P
>
;
...
...
src/test/run-pass/issue-3688-2.rs
浏览文件 @
3ebd878f
fn
f
(
x
:
int
)
{
const
child
:
int
=
x
+
1
;
}
// xfail-test
fn
f
(
x
:
int
)
{
const
child
:
int
=
x
+
1
;
}
fn
main
()
{}
src/test/run-pass/last-use-corner-cases.rs
浏览文件 @
3ebd878f
...
...
@@ -5,7 +5,7 @@ fn main() {
// Make sure closing over can be a last use
let
q
=
~
10
;
let
addr
=
ptr
::
addr_of
(
&
(
*
q
));
let
f
=
fn
@
()
->
*
int
{
ptr
::
addr_of
(
&
(
*
q
))
};
let
f
=
fn
@
(
move
q
)
->
*
int
{
ptr
::
addr_of
(
&
(
*
q
))
};
assert
addr
==
f
();
// But only when it really is the last use
...
...
src/test/run-pass/last-use-in-block.rs
浏览文件 @
3ebd878f
...
...
@@ -3,14 +3,14 @@
fn
lp
<
T
>
(
s
:
~
str
,
f
:
fn
(
~
str
)
->
T
)
->
T
{
while
false
{
let
r
=
f
(
s
);
return
r
;
return
(
move
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
);
r
})
g
(
s
,
|
v
|
{
let
r
=
f
(
v
);
move
r
})
}
fn
main
()
{}
src/test/run-pass/liveness-move-in-loop.rs
浏览文件 @
3ebd878f
...
...
@@ -5,7 +5,7 @@ fn the_loop() {
loop
{
let
x
=
5
;
if
x
>
3
{
list
+=
~
[
take
(
x
)];
list
+=
~
[
take
(
move
x
)];
}
else
{
break
;
}
...
...
src/test/run-pass/log-linearized.rs
浏览文件 @
3ebd878f
...
...
@@ -9,7 +9,7 @@ enum option<T> {
fn
mk
<
T
>
()
->
smallintmap
<
T
>
{
let
v
:
~
[
mut
option
<
T
>
]
=
~
[
mut
];
return
@
{
mut
v
:
v
};
return
@
{
mut
v
:
move
v
};
}
fn
f
<
T
,
U
>
()
{
...
...
src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs
浏览文件 @
3ebd878f
...
...
@@ -15,7 +15,7 @@ struct F<A> { a: A }
impl
<
A
:
Copy
Serializable
>
F
<
A
>
:
Serializable
{
fn
serialize
<
S
:
Serializer
>
(
s
:
S
)
{
self
.a
.serialize
(
s
);
self
.a
.serialize
(
move
s
);
}
}
...
...
src/test/run-pass/move-arg-2-unique.rs
浏览文件 @
3ebd878f
...
...
@@ -3,7 +3,7 @@
fn
main
()
{
let
x
=
~~
[
10
];
// Test forgetting a local by move-in
test
(
x
);
test
(
move
x
);
// Test forgetting a temporary by move-in.
test
(
~~
[
10
]);
...
...
src/test/run-pass/move-arg-2.rs
浏览文件 @
3ebd878f
...
...
@@ -3,7 +3,7 @@
fn
main
()
{
let
x
=
@~
[
10
];
// Test forgetting a local by move-in
test
(
x
);
test
(
move
x
);
// Test forgetting a temporary by move-in.
test
(
@~
[
10
]);
...
...
src/test/run-pass/move-arg.rs
浏览文件 @
3ebd878f
fn
test
(
-
foo
:
int
)
{
assert
(
foo
==
10
);
}
fn
main
()
{
let
x
=
10
;
test
(
x
);
}
fn
main
()
{
let
x
=
10
;
test
(
move
x
);
}
src/test/run-pass/move-nullary-fn.rs
浏览文件 @
3ebd878f
...
...
@@ -2,7 +2,7 @@
fn
f2
(
-
thing
:
fn
@
())
{
}
fn
f
(
-
thing
:
fn
@
())
{
f2
(
thing
);
f2
(
move
thing
);
}
fn
main
()
{
...
...
src/test/run-pass/non-legacy-modes.rs
浏览文件 @
3ebd878f
...
...
@@ -3,7 +3,7 @@ struct X {
}
fn
apply
<
T
>
(
x
:
T
,
f
:
fn
(
T
))
{
f
(
x
);
f
(
move
x
);
}
fn
check_int
(
x
:
int
)
{
...
...
src/test/run-pass/option-unwrap.rs
浏览文件 @
3ebd878f
...
...
@@ -9,7 +9,7 @@ struct dtor {
fn
unwrap
<
T
>
(
+
o
:
Option
<
T
>
)
->
T
{
match
move
o
{
Some
(
move
v
)
=>
v
,
Some
(
move
v
)
=>
move
v
,
None
=>
fail
}
}
...
...
@@ -19,7 +19,7 @@ fn main() {
{
let
b
=
Some
(
dtor
{
x
:
x
});
let
c
=
unwrap
(
b
);
let
c
=
unwrap
(
move
b
);
}
assert
*
x
==
0
;
...
...
src/test/run-pass/pipe-bank-proto.rs
浏览文件 @
3ebd878f
...
...
@@ -33,15 +33,15 @@
)
macro_rules!
move_it
(
{
$x:expr
}
=>
{
unsafe
{
let
y
<-
*
ptr
::
addr_of
(
&
(
$x
));
y
}
}
{
$x:expr
}
=>
{
unsafe
{
let
y
<-
*
ptr
::
addr_of
(
&
(
$x
));
move
y
}
}
)
fn
switch
<
T
:
Send
,
U
>
(
+
endp
:
pipes
::
RecvPacket
<
T
>
,
f
:
fn
(
+
v
:
Option
<
T
>
)
->
U
)
->
U
{
f
(
pipes
::
try_recv
(
endp
))
f
(
pipes
::
try_recv
(
move
endp
))
}
fn
move_it
<
T
>
(
-
x
:
T
)
->
T
{
x
}
fn
move_it
<
T
>
(
-
x
:
T
)
->
T
{
move
x
}
macro_rules!
follow
(
{
...
...
@@ -59,15 +59,15 @@ fn move_it<T>(-x: T) -> T { x }
fn
client_follow
(
+
bank
:
bank
::
client
::
login
)
{
use
bank
::
*
;
let
bank
=
client
::
login
(
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
switch
(
bank
,
follow!
(
ok
->
connected
{
connected
}
let
bank
=
client
::
login
(
move
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
switch
(
move
bank
,
follow!
(
ok
->
connected
{
move
connected
}
invalid
->
_
next
{
fail
~
"bank closed the connected"
}
));
let
bank
=
client
::
deposit
(
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
bank
,
50.00
);
switch
(
bank
,
follow!
(
let
bank
=
client
::
deposit
(
move
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
move
bank
,
50.00
);
switch
(
move
bank
,
follow!
(
money
(
m
)
->
_
next
{
io
::
println
(
~
"Yay! I got money!"
);
}
...
...
@@ -80,8 +80,8 @@ fn client_follow(+bank: bank::client::login) {
fn
bank_client
(
+
bank
:
bank
::
client
::
login
)
{
use
bank
::
*
;
let
bank
=
client
::
login
(
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
match
try_recv
(
bank
)
{
let
bank
=
client
::
login
(
move
bank
,
~
"theincredibleholk"
,
~
"1234"
);
let
bank
=
match
try_recv
(
move
bank
)
{
Some
(
ok
(
connected
))
=>
{
move_it!
(
connected
)
}
...
...
@@ -89,10 +89,10 @@ fn bank_client(+bank: bank::client::login) {
None
=>
{
fail
~
"bank closed the connection"
}
};
let
bank
=
client
::
deposit
(
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
bank
,
50.00
);
match
try_recv
(
bank
)
{
Some
(
money
(
m
,
_
))
=>
{
let
bank
=
client
::
deposit
(
move
bank
,
100.00
);
let
bank
=
client
::
withdrawal
(
move
bank
,
50.00
);
match
try_recv
(
move
bank
)
{
Some
(
money
(
*
))
=>
{
io
::
println
(
~
"Yay! I got money!"
);
}
Some
(
insufficient_funds
(
_
))
=>
{
...
...
src/test/run-pass/pipe-detect-term.rs
浏览文件 @
3ebd878f
...
...
@@ -19,7 +19,7 @@ fn main() {
let
iotask
=
uv
::
global_loop
::
get
();
pipes
::
spawn_service
(
oneshot
::
init
,
|
p
|
{
match
try_recv
(
p
)
{
match
try_recv
(
move
p
)
{
Some
(
*
)
=>
{
fail
}
None
=>
{
}
}
...
...
@@ -34,11 +34,11 @@ fn main() {
fn
failtest
()
{
let
(
c
,
p
)
=
oneshot
::
init
();
do
task
::
spawn_with
(
c
)
|
_
c
|
{
do
task
::
spawn_with
(
move
c
)
|
_
c
|
{
fail
;
}
error!
(
"%?"
,
recv
(
p
));
error!
(
"%?"
,
recv
(
move
p
));
// make sure we get killed if we missed it in the receive.
loop
{
task
::
yield
()
}
}
src/test/run-pass/pipe-peek.rs
浏览文件 @
3ebd878f
...
...
@@ -15,7 +15,7 @@ fn main() {
assert
!
pipes
::
peek
(
&
p
);
oneshot
::
client
::
signal
(
c
);
oneshot
::
client
::
signal
(
move
c
);
assert
pipes
::
peek
(
&
p
);
}
src/test/run-pass/pipe-pingpong-bounded.rs
浏览文件 @
3ebd878f
...
...
@@ -25,7 +25,7 @@ fn init() -> (client::ping, server::ping) {
pong
:
mk_packet
::
<
pong
>
()
}
};
do
pipes
::
entangle_buffer
(
buffer
)
|
buffer
,
data
|
{
do
pipes
::
entangle_buffer
(
move
buffer
)
|
buffer
,
data
|
{
data
.ping
.set_buffer_
(
buffer
);
data
.pong
.set_buffer_
(
buffer
);
ptr
::
addr_of
(
&
(
data
.ping
))
...
...
@@ -40,9 +40,9 @@ fn ping(+pipe: ping) -> pong {
let
b
=
pipe
.reuse_buffer
();
let
s
=
SendPacketBuffered
(
ptr
::
addr_of
(
&
(
b
.buffer.data.pong
)));
let
c
=
RecvPacketBuffered
(
ptr
::
addr_of
(
&
(
b
.buffer.data.pong
)));
let
message
=
pingpong
::
ping
(
s
);
pipes
::
send
(
pipe
,
message
);
c
let
message
=
pingpong
::
ping
(
move
s
);
pipes
::
send
(
move
pipe
,
move
message
);
move
c
}
}
type
ping
=
pipes
::
SendPacketBuffered
<
pingpong
::
ping
,
...
...
@@ -59,9 +59,9 @@ fn pong(+pipe: pong) -> ping {
let
b
=
pipe
.reuse_buffer
();
let
s
=
SendPacketBuffered
(
ptr
::
addr_of
(
&
(
b
.buffer.data.ping
)));
let
c
=
RecvPacketBuffered
(
ptr
::
addr_of
(
&
(
b
.buffer.data.ping
)));
let
message
=
pingpong
::
pong
(
s
);
pipes
::
send
(
pipe
,
message
);
c
let
message
=
pingpong
::
pong
(
move
s
);
pipes
::
send
(
move
pipe
,
move
message
);
move
c
}
}
type
pong
=
pipes
::
SendPacketBuffered
<
pingpong
::
pong
,
...
...
@@ -77,34 +77,34 @@ mod test {
fn
client
(
-
chan
:
pingpong
::
client
::
ping
)
{
use
pingpong
::
client
;
let
chan
=
client
::
ping
(
chan
);
return
;
let
chan
=
client
::
ping
(
move
chan
);
return
;
log
(
error
,
"Sent ping"
);
let
pong
(
_
chan
)
=
recv
(
chan
);
let
pong
(
_
chan
)
=
recv
(
move
chan
);
log
(
error
,
"Received pong"
);
}
fn
server
(
-
chan
:
pingpong
::
server
::
ping
)
{
use
pingpong
::
server
;
let
ping
(
chan
)
=
recv
(
chan
);
return
;
let
ping
(
chan
)
=
recv
(
move
chan
);
return
;
log
(
error
,
"Received ping"
);
let
_
chan
=
server
::
pong
(
chan
);
let
_
chan
=
server
::
pong
(
move
chan
);
log
(
error
,
"Sent pong"
);
}
}
fn
main
()
{
let
(
client_
,
server_
)
=
pingpong
::
init
();
let
client_
=
~
mut
Some
(
client_
);
let
server_
=
~
mut
Some
(
server_
);
let
client_
=
~
mut
Some
(
move
client_
);
let
server_
=
~
mut
Some
(
move
server_
);
do
task
::
spawn
|
move
client_
|
{
let
mut
client__
=
None
;
*
client_
<->
client__
;
test
::
client
(
option
::
unwrap
(
client__
));
test
::
client
(
option
::
unwrap
(
move
client__
));
};
do
task
::
spawn
|
move
server_
|
{
let
mut
server_
ˊ
=
None
;
*
server_
<->
server_
ˊ
;
test
::
server
(
option
::
unwrap
(
server_
ˊ
));
test
::
server
(
option
::
unwrap
(
move
server_
ˊ
));
};
}
src/test/run-pass/pipe-pingpong-proto.rs
浏览文件 @
3ebd878f
...
...
@@ -20,35 +20,35 @@ mod test {
fn
client
(
-
chan
:
pingpong
::
client
::
ping
)
{
use
pingpong
::
client
;
let
chan
=
client
::
ping
(
chan
);
let
chan
=
client
::
ping
(
move
chan
);
log
(
error
,
~
"Sent ping"
);
let
pong
(
_
chan
)
=
recv
(
chan
);
let
pong
(
_
chan
)
=
recv
(
move
chan
);
log
(
error
,
~
"Received pong"
);
}
fn
server
(
-
chan
:
pingpong
::
server
::
ping
)
{
use
pingpong
::
server
;
let
ping
(
chan
)
=
recv
(
chan
);
let
ping
(
chan
)
=
recv
(
move
chan
);
log
(
error
,
~
"Received ping"
);
let
_
chan
=
server
::
pong
(
chan
);
let
_
chan
=
server
::
pong
(
move
chan
);
log
(
error
,
~
"Sent pong"
);
}
}
fn
main
()
{
let
(
client_
,
server_
)
=
pingpong
::
init
();
let
client_
=
~
mut
Some
(
client_
);
let
server_
=
~
mut
Some
(
server_
);
let
client_
=
~
mut
Some
(
move
client_
);
let
server_
=
~
mut
Some
(
move
server_
);
do
task
::
spawn
|
move
client_
|
{
let
mut
client__
=
None
;
*
client_
<->
client__
;
test
::
client
(
option
::
unwrap
(
client__
));
test
::
client
(
option
::
unwrap
(
move
client__
));
};
do
task
::
spawn
|
move
server_
|
{
let
mut
server_
ˊ
=
None
;
*
server_
<->
server_
ˊ
;
test
::
server
(
option
::
unwrap
(
server_
ˊ
));
test
::
server
(
option
::
unwrap
(
move
server_
ˊ
));
};
}
src/test/run-pass/pipe-presentation-examples.rs
浏览文件 @
3ebd878f
...
...
@@ -22,10 +22,10 @@
],
)
*
}
=>
{
if
$index
==
$count
{
match
move
pipes
::
try_recv
(
$port
)
{
match
move
pipes
::
try_recv
(
move
$port
)
{
$
(
Some
(
$message
(
$
(
$
(
move
$x
,)
+
)
*
move
next
))
=>
{
let
$next
=
next
;
$e
let
$next
=
move
next
;
move
$e
})
+
_
=>
fail
}
...
...
@@ -90,33 +90,33 @@ fn render(_buffer: &Buffer) {
}
fn
draw_frame
(
+
channel
:
double_buffer
::
client
::
acquire
)
{
let
channel
=
request
(
channel
);
let
channel
=
request
(
move
channel
);
select!
(
channel
=>
{
give_buffer
(
buffer
)
->
channel
{
render
(
&
buffer
);
release
(
channel
,
move
buffer
)
release
(
move
channel
,
move
buffer
)
}
}
);
}
fn
draw_two_frames
(
+
channel
:
double_buffer
::
client
::
acquire
)
{
let
channel
=
request
(
channel
);
let
channel
=
request
(
move
channel
);
let
channel
=
select!
(
channel
=>
{
give_buffer
(
buffer
)
->
channel
{
render
(
&
buffer
);
release
(
channel
,
move
buffer
)
release
(
move
channel
,
move
buffer
)
}
}
);
let
channel
=
request
(
channel
);
let
channel
=
request
(
move
channel
);
select!
(
channel
=>
{
give_buffer
(
buffer
)
->
channel
{
render
(
&
buffer
);
release
(
channel
,
move
buffer
)
release
(
move
channel
,
move
buffer
)
}
}
);
...
...
src/test/run-pass/pipe-select-macro.rs
浏览文件 @
3ebd878f
// tjc: un-xfail after snapshot
// xfail-test
// xfail-pretty
// Protocols
...
...
src/test/run-pass/pipe-select.rs
浏览文件 @
3ebd878f
...
...
@@ -27,24 +27,24 @@ fn main() {
let
c
=
pipes
::
spawn_service
(
stream
::
init
,
|
p
|
{
error!
(
"waiting for pipes"
);
let
stream
::
send
(
x
,
p
)
=
recv
(
p
);
let
stream
::
send
(
x
,
p
)
=
recv
(
move
p
);
error!
(
"got pipes"
);
let
(
left
,
right
)
:
(
oneshot
::
server
::
waiting
,
oneshot
::
server
::
waiting
)
=
x
;
=
move
x
;
error!
(
"selecting"
);
let
(
i
,
_
,
_
)
=
select
(
~
[
left
,
right
]);
let
(
i
,
_
,
_
)
=
select
(
~
[
move
left
,
move
right
]);
error!
(
"selected"
);
assert
i
==
0
;
error!
(
"waiting for pipes"
);
let
stream
::
send
(
x
,
_
)
=
recv
(
p
);
let
stream
::
send
(
x
,
_
)
=
recv
(
move
p
);
error!
(
"got pipes"
);
let
(
left
,
right
)
:
(
oneshot
::
server
::
waiting
,
oneshot
::
server
::
waiting
)
=
x
;
=
move
x
;
error!
(
"selecting"
);
let
(
i
,
m
,
_
)
=
select
(
~
[
left
,
right
]);
let
(
i
,
m
,
_
)
=
select
(
~
[
move
left
,
move
right
]);
error!
(
"selected %?"
,
i
);
if
m
.is_some
()
{
assert
i
==
1
;
...
...
@@ -54,20 +54,20 @@ fn main() {
let
(
c1
,
p1
)
=
oneshot
::
init
();
let
(
_
c2
,
p2
)
=
oneshot
::
init
();
let
c
=
send
(
c
,
(
p1
,
p2
));
let
c
=
send
(
move
c
,
(
move
p1
,
move
p2
));
sleep
(
iotask
,
100
);
signal
(
c1
);
signal
(
move
c1
);
let
(
_
c1
,
p1
)
=
oneshot
::
init
();
let
(
c2
,
p2
)
=
oneshot
::
init
();
send
(
c
,
(
p1
,
p2
));
send
(
move
c
,
(
move
p1
,
move
p2
));
sleep
(
iotask
,
100
);
signal
(
c2
);
signal
(
move
c2
);
test_select2
();
}
...
...
@@ -76,26 +76,26 @@ fn test_select2() {
let
(
ac
,
ap
)
=
stream
::
init
();
let
(
bc
,
bp
)
=
stream
::
init
();
stream
::
client
::
send
(
ac
,
42
);
stream
::
client
::
send
(
move
ac
,
42
);
match
pipes
::
select2
(
ap
,
bp
)
{
match
pipes
::
select2
(
move
ap
,
move
bp
)
{
either
::
Left
(
*
)
=>
{
}
either
::
Right
(
*
)
=>
{
fail
}
}
stream
::
client
::
send
(
bc
,
~
"abc"
);
stream
::
client
::
send
(
move
bc
,
~
"abc"
);
error!
(
"done with first select2"
);
let
(
ac
,
ap
)
=
stream
::
init
();
let
(
bc
,
bp
)
=
stream
::
init
();
stream
::
client
::
send
(
bc
,
~
"abc"
);
stream
::
client
::
send
(
move
bc
,
~
"abc"
);
match
pipes
::
select2
(
ap
,
bp
)
{
match
pipes
::
select2
(
move
ap
,
move
bp
)
{
either
::
Left
(
*
)
=>
{
fail
}
either
::
Right
(
*
)
=>
{
}
}
stream
::
client
::
send
(
ac
,
42
);
stream
::
client
::
send
(
move
ac
,
42
);
}
src/test/run-pass/pipe-sleep.rs
浏览文件 @
3ebd878f
...
...
@@ -14,10 +14,10 @@
fn
main
()
{
use
oneshot
::
client
::
*
;
let
c
=
pipes
::
spawn_service
(
oneshot
::
init
,
|
p
|
{
recv
(
p
);
});
let
c
=
pipes
::
spawn_service
(
oneshot
::
init
,
|
p
|
{
recv
(
move
p
);
});
let
iotask
=
uv
::
global_loop
::
get
();
sleep
(
iotask
,
500
);
signal
(
c
);
signal
(
move
c
);
}
\ No newline at end of file
src/test/run-pass/regions-copy-closure.rs
浏览文件 @
3ebd878f
...
...
@@ -2,8 +2,8 @@ struct closure_box {
cl
:
&
fn
(),
}
fn
box_it
(
x
:
&
r
/
fn
())
->
closure_box
/&
r
{
closure_box
{
cl
:
x
}
fn
box_it
(
+
x
:
&
r
/
fn
())
->
closure_box
/&
r
{
closure_box
{
cl
:
move
x
}
}
fn
main
()
{
...
...
src/test/run-pass/regions-static-closure.rs
浏览文件 @
3ebd878f
...
...
@@ -2,8 +2,8 @@ struct closure_box {
cl
:
&
fn
(),
}
fn
box_it
(
x
:
&
r
/
fn
())
->
closure_box
/&
r
{
closure_box
{
cl
:
x
}
fn
box_it
(
+
x
:
&
r
/
fn
())
->
closure_box
/&
r
{
closure_box
{
cl
:
move
x
}
}
fn
call_static_closure
(
cl
:
closure_box
/&
static
)
{
...
...
@@ -12,5 +12,5 @@ fn call_static_closure(cl: closure_box/&static) {
fn
main
()
{
let
cl_box
=
box_it
(||
debug!
(
"Hello, world!"
));
call_static_closure
(
cl_box
);
call_static_closure
(
move
cl_box
);
}
src/test/run-pass/resource-assign-is-not-copy.rs
浏览文件 @
3ebd878f
...
...
@@ -14,8 +14,8 @@ fn main() {
// Even though these look like copies, they are guaranteed not to be
{
let
a
=
r
(
i
);
let
b
=
(
a
,
10
);
let
(
c
,
_
d
)
=
b
;
let
b
=
(
move
a
,
10
);
let
(
c
,
_
d
)
=
move
b
;
log
(
debug
,
c
);
}
assert
*
i
==
1
;
...
...
src/test/run-pass/resource-cycle.rs
浏览文件 @
3ebd878f
...
...
@@ -24,10 +24,10 @@ enum t = {
fn
main
()
unsafe
{
let
i1
=
~
0
;
let
i1p
=
cast
::
reinterpret_cast
(
&
i1
);
cast
::
forget
(
i1
);
cast
::
forget
(
move
i1
);
let
i2
=
~
0
;
let
i2p
=
cast
::
reinterpret_cast
(
&
i2
);
cast
::
forget
(
i2
);
cast
::
forget
(
move
i2
);
let
x1
=
@
t
({
mut
next
:
None
,
...
...
@@ -35,7 +35,7 @@ fn main() unsafe {
let
rs
=
r
(
i1p
);
debug!
(
"r = %x"
,
cast
::
reinterpret_cast
::
<*
r
,
uint
>
(
&
ptr
::
addr_of
(
&
rs
)));
rs
}
move
rs
}
});
debug!
(
"x1 = %x, x1.r = %x"
,
...
...
@@ -48,7 +48,7 @@ fn main() unsafe {
let
rs
=
r
(
i2p
);
debug!
(
"r2 = %x"
,
cast
::
reinterpret_cast
::
<*
r
,
uint
>
(
&
ptr
::
addr_of
(
&
rs
)));
rs
move
rs
}
});
...
...
src/test/run-pass/resource-cycle2.rs
浏览文件 @
3ebd878f
...
...
@@ -27,10 +27,10 @@ enum t = {
fn
main
()
unsafe
{
let
i1
=
~
0xA
;
let
i1p
=
cast
::
reinterpret_cast
(
&
i1
);
cast
::
forget
(
i1
);
cast
::
forget
(
move
i1
);
let
i2
=
~
0xA
;
let
i2p
=
cast
::
reinterpret_cast
(
&
i2
);
cast
::
forget
(
i2
);
cast
::
forget
(
move
i2
);
let
u1
=
{
a
:
0xB
,
b
:
0xC
,
c
:
i1p
};
let
u2
=
{
a
:
0xB
,
b
:
0xC
,
c
:
i2p
};
...
...
src/test/run-pass/resource-cycle3.rs
浏览文件 @
3ebd878f
...
...
@@ -34,10 +34,10 @@ enum t = {
fn
main
()
unsafe
{
let
i1
=
~
0xA
;
let
i1p
=
cast
::
reinterpret_cast
(
&
i1
);
cast
::
forget
(
i1
);
cast
::
forget
(
move
i1
);
let
i2
=
~
0xA
;
let
i2p
=
cast
::
reinterpret_cast
(
&
i2
);
cast
::
forget
(
i2
);
cast
::
forget
(
move
i2
);
let
u1
=
{
a
:
0xB
,
b
:
0xC
,
c
:
i1p
};
let
u2
=
{
a
:
0xB
,
b
:
0xC
,
c
:
i2p
};
...
...
src/test/run-pass/rt-sched-1.rs
浏览文件 @
3ebd878f
...
...
@@ -35,6 +35,6 @@ fn main() unsafe {
};
let
fptr
=
cast
::
reinterpret_cast
(
&
ptr
::
addr_of
(
&
f
));
rustrt
::
start_task
(
new_task_id
,
fptr
);
cast
::
forget
(
f
);
cast
::
forget
(
move
f
);
comm
::
recv
(
po
);
}
src/test/run-pass/select-macro.rs
浏览文件 @
3ebd878f
...
...
@@ -17,18 +17,18 @@
$count:expr
,
$port:path
=>
[
$
(
type_this
$message:path$
((
$
(
x
$x
:
ident
),
+
))
dont_type_this
*
->
$next:ident
=>
{
$e:expr
}),
+
->
$next:ident
=>
{
move
$e:expr
}),
+
]
$
(,
$ports:path
=>
[
$
(
type_this
$messages:path$
((
$
(
x
$xs
:
ident
),
+
))
dont_type_this
*
->
$nexts:ident
=>
{
$es:expr
}),
+
->
$nexts:ident
=>
{
move
$es:expr
}),
+
]
)
*
}
=>
{
if
$index
==
$count
{
match
move
pipes
::
try_recv
(
$port
)
{
$
(
Some
(
$message
(
$
(
$
(
move
$x
,)
+
)
*
move
next
))
=>
{
let
$next
=
next
;
$e
let
$next
=
move
next
;
move
$e
})
+
_
=>
fail
}
...
...
@@ -38,7 +38,7 @@
$count
+
1
$
(,
$ports
=>
[
$
(
type_this
$messages$
((
$
(
x
$xs
),
+
))
dont_type_this
*
->
$nexts
=>
{
$es
}),
+
->
$nexts
=>
{
move
$es
}),
+
])
*
)
}
...
...
@@ -54,7 +54,7 @@
}
=>
{
let
index
=
pipes
::
selecti
([
$
((
$port
)
.header
()),
+
]
/
_
);
select_if!
(
index
,
0
$
(,
$port
=>
[
$
(
type_this
$message$
((
$
(
x
$x
),
+
))
dont_type_this
*
->
$next
=>
{
$e
}),
+
$
(
type_this
$message$
((
$
(
x
$x
),
+
))
dont_type_this
*
->
$next
=>
{
move
$e
}),
+
])
+
)
}
)
...
...
src/test/run-pass/static-method-test.rs
浏览文件 @
3ebd878f
...
...
@@ -13,13 +13,13 @@ fn andand<T: bool_like Copy>(x1: T, x2: T) -> T {
impl
bool
:
bool_like
{
static
fn
select
<
A
>
(
&&
b
:
bool
,
+
x1
:
A
,
+
x2
:
A
)
->
A
{
if
b
{
x1
}
else
{
x2
}
if
b
{
move
x1
}
else
{
move
x2
}
}
}
impl
int
:
bool_like
{
static
fn
select
<
A
>
(
&&
b
:
int
,
+
x1
:
A
,
+
x2
:
A
)
->
A
{
if
b
!=
0
{
x1
}
else
{
x2
}
if
b
!=
0
{
move
x1
}
else
{
move
x2
}
}
}
...
...
src/test/run-pass/task-comm-0.rs
浏览文件 @
3ebd878f
...
...
@@ -19,7 +19,7 @@ fn test05_start(ch : Chan<int>) {
fn
test05
()
{
let
(
ch
,
po
)
=
pipes
::
stream
();
task
::
spawn
(||
test05_start
(
ch
)
);
task
::
spawn
(|
move
ch
|
test05_start
(
ch
)
);
let
mut
value
=
po
.recv
();
log
(
error
,
value
);
value
=
po
.recv
();
...
...
src/test/run-pass/task-comm-10.rs
浏览文件 @
3ebd878f
...
...
@@ -5,7 +5,7 @@
fn
start
(
c
:
pipes
::
Chan
<
pipes
::
Chan
<~
str
>>
)
{
let
(
ch
,
p
)
=
pipes
::
stream
();
c
.send
(
ch
);
c
.send
(
move
ch
);
let
mut
a
;
let
mut
b
;
...
...
@@ -14,12 +14,12 @@ fn start(c: pipes::Chan<pipes::Chan<~str>>) {
log
(
error
,
a
);
b
=
p
.recv
();
assert
b
==
~
"B"
;
log
(
error
,
b
);
log
(
error
,
move
b
);
}
fn
main
()
{
let
(
ch
,
p
)
=
pipes
::
stream
();
let
child
=
task
::
spawn
(||
start
(
ch
)
);
let
child
=
task
::
spawn
(|
move
ch
|
start
(
ch
)
);
let
c
=
p
.recv
();
c
.send
(
~
"A"
);
...
...
src/test/run-pass/task-comm-11.rs
浏览文件 @
3ebd878f
...
...
@@ -5,11 +5,11 @@
fn
start
(
c
:
pipes
::
Chan
<
pipes
::
Chan
<
int
>>
)
{
let
(
ch
,
p
)
=
pipes
::
stream
();
c
.send
(
ch
);
c
.send
(
move
ch
);
}
fn
main
()
{
let
(
ch
,
p
)
=
pipes
::
stream
();
let
child
=
task
::
spawn
(||
start
(
ch
)
);
let
child
=
task
::
spawn
(|
move
ch
|
start
(
ch
)
);
let
c
=
p
.recv
();
}
src/test/run-pass/task-comm-12.rs
浏览文件 @
3ebd878f
...
...
@@ -7,7 +7,7 @@
fn
test00
()
{
let
i
:
int
=
0
;
let
mut
result
=
None
;
do
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
r
);
})
.spawn
{
do
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
move
r
);
})
.spawn
{
start
(
i
)
}
...
...
@@ -19,7 +19,7 @@ fn test00() {
}
// Try joining tasks that have already finished.
future
::
get
(
&
option
::
unwrap
(
result
));
future
::
get
(
&
option
::
unwrap
(
move
result
));
debug!
(
"Joined task."
);
}
src/test/run-pass/task-comm-13.rs
浏览文件 @
3ebd878f
...
...
@@ -12,6 +12,6 @@ fn start(c: pipes::Chan<int>, start: int, number_of_messages: int) {
fn
main
()
{
debug!
(
"Check that we don't deadlock."
);
let
(
ch
,
p
)
=
pipes
::
stream
();
task
::
try
(||
start
(
ch
,
0
,
10
)
);
task
::
try
(|
move
ch
|
start
(
ch
,
0
,
10
)
);
debug!
(
"Joined task"
);
}
src/test/run-pass/task-comm-14.rs
浏览文件 @
3ebd878f
...
...
@@ -9,8 +9,8 @@ fn main() {
while
(
i
>
0
)
{
log
(
debug
,
i
);
let
(
ch
,
p
)
=
pipes
::
stream
();
po
.add
(
p
);
task
::
spawn
(|
copy
i
|
child
(
i
,
ch
)
);
po
.add
(
move
p
);
task
::
spawn
(|
move
ch
,
copy
i
|
child
(
i
,
ch
)
);
i
=
i
-
1
;
}
...
...
src/test/run-pass/task-comm-15.rs
浏览文件 @
3ebd878f
...
...
@@ -18,6 +18,6 @@ fn main() {
// the child's point of view the receiver may die. We should
// drop messages on the floor in this case, and not crash!
let
(
ch
,
p
)
=
pipes
::
stream
();
task
::
spawn
(||
start
(
ch
,
10
));
task
::
spawn
(|
move
ch
|
start
(
ch
,
10
));
p
.recv
();
}
src/test/run-pass/task-comm-16.rs
浏览文件 @
3ebd878f
...
...
@@ -91,7 +91,7 @@ fn test_tag() {
fn
test_chan
()
{
let
(
ch
,
po
)
=
pipes
::
stream
();
let
(
ch0
,
po0
)
=
pipes
::
stream
();
ch
.send
(
ch0
);
ch
.send
(
move
ch0
);
let
ch1
=
po
.recv
();
// Does the transmitted channel still work?
...
...
src/test/run-pass/task-comm-3.rs
浏览文件 @
3ebd878f
...
...
@@ -34,8 +34,8 @@ fn test00() {
while
i
<
number_of_tasks
{
let
ch
=
po
.chan
();
do
task
::
task
()
.future_result
(|
+
r
|
{
results
.push
(
r
);
})
.spawn
|
copy
i
|
{
results
.push
(
move
r
);
})
.spawn
|
move
ch
,
copy
i
|
{
test00_start
(
ch
,
i
,
number_of_messages
)
}
i
=
i
+
1
;
...
...
src/test/run-pass/task-comm-7.rs
浏览文件 @
3ebd878f
...
...
@@ -17,19 +17,19 @@ fn test00() {
let
number_of_messages
:
int
=
10
;
let
c
=
p
.chan
();
do
task
::
spawn
{
do
task
::
spawn
|
move
c
|
{
test00_start
(
c
,
number_of_messages
*
0
,
number_of_messages
);
}
let
c
=
p
.chan
();
do
task
::
spawn
{
do
task
::
spawn
|
move
c
|
{
test00_start
(
c
,
number_of_messages
*
1
,
number_of_messages
);
}
let
c
=
p
.chan
();
do
task
::
spawn
{
do
task
::
spawn
|
move
c
|
{
test00_start
(
c
,
number_of_messages
*
2
,
number_of_messages
);
}
let
c
=
p
.chan
();
do
task
::
spawn
{
do
task
::
spawn
|
move
c
|
{
test00_start
(
c
,
number_of_messages
*
3
,
number_of_messages
);
}
...
...
src/test/run-pass/task-comm-9.rs
浏览文件 @
3ebd878f
...
...
@@ -18,7 +18,8 @@ fn test00() {
let
ch
=
p
.chan
();
let
mut
result
=
None
;
do
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
r
);
})
.spawn
{
do
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
move
r
);
})
.spawn
|
move
ch
|
{
test00_start
(
ch
,
number_of_messages
);
}
...
...
@@ -29,7 +30,7 @@ fn test00() {
i
+=
1
;
}
future
::
get
(
&
option
::
unwrap
(
result
));
future
::
get
(
&
option
::
unwrap
(
move
result
));
assert
(
sum
==
number_of_messages
*
(
number_of_messages
-
1
)
/
2
);
}
src/test/run-pass/task-comm.rs
浏览文件 @
3ebd878f
...
...
@@ -40,7 +40,7 @@ fn test00() {
while
i
<
number_of_tasks
{
i
=
i
+
1
;
do
task
::
task
()
.future_result
(|
+
r
|
{
results
.push
(
r
);
results
.push
(
move
r
);
})
.spawn
|
copy
i
|
{
test00_start
(
ch
,
i
,
number_of_messages
);
}
...
...
@@ -127,7 +127,7 @@ fn test06() {
while
i
<
number_of_tasks
{
i
=
i
+
1
;
do
task
::
task
()
.future_result
(|
+
r
|
{
results
.push
(
r
);
results
.push
(
move
r
);
})
.spawn
|
copy
i
|
{
test06_start
(
i
);
};
...
...
src/test/run-pass/trait-to-str.rs
浏览文件 @
3ebd878f
...
...
@@ -30,7 +30,7 @@ fn indirect<T: to_str>(x: T) -> ~str {
assert
indirect
(
~
[
10
,
20
])
==
~
"[10, 20]!"
;
fn
indirect2
<
T
:
to_str
>
(
x
:
T
)
->
~
str
{
indirect
(
x
)
indirect
(
move
x
)
}
assert
indirect2
(
~
[
1
])
==
~
"[1]!"
;
}
src/test/run-pass/unique-fn-arg-move.rs
浏览文件 @
3ebd878f
...
...
@@ -4,5 +4,5 @@ fn f(-i: ~int) {
fn
main
()
{
let
i
=
~
100
;
f
(
i
);
f
(
move
i
);
}
\ No newline at end of file
src/test/run-pass/yield.rs
浏览文件 @
3ebd878f
...
...
@@ -4,13 +4,13 @@
fn
main
()
{
let
mut
result
=
None
;
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
r
);
})
.spawn
(
child
);
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
move
r
);
})
.spawn
(
child
);
error!
(
"1"
);
yield
();
error!
(
"2"
);
yield
();
error!
(
"3"
);
future
::
get
(
&
option
::
unwrap
(
result
));
future
::
get
(
&
option
::
unwrap
(
move
result
));
}
fn
child
()
{
...
...
src/test/run-pass/yield1.rs
浏览文件 @
3ebd878f
...
...
@@ -4,10 +4,10 @@
fn
main
()
{
let
mut
result
=
None
;
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
r
);
})
.spawn
(
child
);
task
::
task
()
.future_result
(|
+
r
|
{
result
=
Some
(
move
r
);
})
.spawn
(
child
);
error!
(
"1"
);
yield
();
future
::
get
(
&
option
::
unwrap
(
result
));
future
::
get
(
&
option
::
unwrap
(
move
result
));
}
fn
child
()
{
error!
(
"2"
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录