Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ba739b21
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,发现更多精彩内容 >>
提交
ba739b21
编写于
11月 18, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: Convert `~fn()` to `proc()` everywhere.
上级
77f621bf
变更
43
显示空白变更内容
内联
并排
Showing
43 changed file
with
57 addition
and
145 deletion
+57
-145
doc/po/ja/tutorial-tasks.md.po
doc/po/ja/tutorial-tasks.md.po
+1
-1
doc/po/ja/tutorial.md.po
doc/po/ja/tutorial.md.po
+4
-4
doc/po/tutorial-tasks.md.pot
doc/po/tutorial-tasks.md.pot
+1
-1
doc/po/tutorial.md.pot
doc/po/tutorial.md.pot
+2
-2
doc/tutorial-tasks.md
doc/tutorial-tasks.md
+1
-1
doc/tutorial.md
doc/tutorial.md
+2
-2
src/libextra/task_pool.rs
src/libextra/task_pool.rs
+1
-1
src/librustuv/net.rs
src/librustuv/net.rs
+2
-2
src/test/bench/task-perf-linked-failure.rs
src/test/bench/task-perf-linked-failure.rs
+1
-1
src/test/compile-fail/borrowck-call-sendfn.rs
src/test/compile-fail/borrowck-call-sendfn.rs
+1
-1
src/test/compile-fail/borrowck-move-by-capture.rs
src/test/compile-fail/borrowck-move-by-capture.rs
+1
-6
src/test/compile-fail/borrowck-move-moved-value-into-closure.rs
...st/compile-fail/borrowck-move-moved-value-into-closure.rs
+1
-1
src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs
...e-fail/closure-bounds-cant-promote-superkind-in-struct.rs
+2
-2
src/test/compile-fail/kindck-nonsendable-1.rs
src/test/compile-fail/kindck-nonsendable-1.rs
+3
-3
src/test/compile-fail/kindck-send.rs
src/test/compile-fail/kindck-send.rs
+1
-1
src/test/compile-fail/moves-sru-moved-field.rs
src/test/compile-fail/moves-sru-moved-field.rs
+1
-1
src/test/compile-fail/once-cant-move-out-of-non-once-on-heap.rs
...st/compile-fail/once-cant-move-out-of-non-once-on-heap.rs
+0
-29
src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs
...t/compile-fail/regions-infer-region-in-fn-but-not-type.rs
+1
-1
src/test/debug-info/lexical-scope-in-unique-closure.rs
src/test/debug-info/lexical-scope-in-unique-closure.rs
+1
-1
src/test/debug-info/var-captured-in-sendable-closure.rs
src/test/debug-info/var-captured-in-sendable-closure.rs
+1
-1
src/test/pretty/fn-types.rs
src/test/pretty/fn-types.rs
+1
-1
src/test/run-fail/unwind-box-fn-unique.rs
src/test/run-fail/unwind-box-fn-unique.rs
+1
-1
src/test/run-pass/block-arg-call-as.rs
src/test/run-pass/block-arg-call-as.rs
+1
-1
src/test/run-pass/borrowck-move-by-capture-ok.rs
src/test/run-pass/borrowck-move-by-capture-ok.rs
+1
-1
src/test/run-pass/cap-clause-move.rs
src/test/run-pass/cap-clause-move.rs
+2
-2
src/test/run-pass/clone-with-exterior.rs
src/test/run-pass/clone-with-exterior.rs
+1
-1
src/test/run-pass/closure-bounds-can-capture-chan.rs
src/test/run-pass/closure-bounds-can-capture-chan.rs
+1
-1
src/test/run-pass/explicit-self-generic.rs
src/test/run-pass/explicit-self-generic.rs
+2
-2
src/test/run-pass/issue-2190-1.rs
src/test/run-pass/issue-2190-1.rs
+1
-1
src/test/run-pass/issue-2190.rs
src/test/run-pass/issue-2190.rs
+1
-1
src/test/run-pass/issue-3424.rs
src/test/run-pass/issue-3424.rs
+1
-1
src/test/run-pass/issue-3609.rs
src/test/run-pass/issue-3609.rs
+1
-1
src/test/run-pass/issue-6141-leaking-owned-fn.rs
src/test/run-pass/issue-6141-leaking-owned-fn.rs
+0
-8
src/test/run-pass/newlambdas-ret-infer.rs
src/test/run-pass/newlambdas-ret-infer.rs
+1
-1
src/test/run-pass/newlambdas-ret-infer2.rs
src/test/run-pass/newlambdas-ret-infer2.rs
+1
-1
src/test/run-pass/operator-overloading.rs
src/test/run-pass/operator-overloading.rs
+1
-1
src/test/run-pass/sendfn-generic-fn.rs
src/test/run-pass/sendfn-generic-fn.rs
+0
-46
src/test/run-pass/sendfn-spawn-with-fn-arg.rs
src/test/run-pass/sendfn-spawn-with-fn-arg.rs
+2
-2
src/test/run-pass/swap-overlapping.rs
src/test/run-pass/swap-overlapping.rs
+2
-2
src/test/run-pass/task-killjoin-rsrc.rs
src/test/run-pass/task-killjoin-rsrc.rs
+1
-1
src/test/run-pass/tempfile.rs
src/test/run-pass/tempfile.rs
+3
-3
src/test/run-pass/uniq-cc-generic.rs
src/test/run-pass/uniq-cc-generic.rs
+3
-3
src/test/run-pass/uniq-cc.rs
src/test/run-pass/uniq-cc.rs
+1
-1
未找到文件。
doc/po/ja/tutorial-tasks.md.po
浏览文件 @
ba739b21
...
...
@@ -213,7 +213,7 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:102
msgid ""
"The `spawn` function has a very simple type signature: `fn spawn(f:
~fn
())`. "
"The `spawn` function has a very simple type signature: `fn spawn(f:
proc
())`. "
"Because it accepts only owned closures, and owned closures contain only "
"owned data, `spawn` can safely move the entire closure and all its "
"associated state into an entirely different task for execution. Like any "
...
...
doc/po/ja/tutorial.md.po
浏览文件 @
ba739b21
...
...
@@ -3509,13 +3509,13 @@ msgstr "## 所有クロージャ"
#. type: Plain text
#: doc/tutorial.md:1510
msgid ""
"Owned closures, written `
~fn` in analogy to the `~` pointer type
, hold on to "
"Owned closures, written `
proc`
, hold on to "
"things that can safely be sent between processes. They copy the values they "
"close over, much like managed closures, but they also own them: that is, no "
"other code can access them. Owned closures are used in concurrent code, "
"particularly for spawning [tasks][tasks]."
msgstr ""
"`~`
ポインタ型と同様に `~fn` 型
で書き表される所有クロージャは安全にプロセス"
"`~`
`proc`
で書き表される所有クロージャは安全にプロセス"
"間で送信することができます。所有クローじゃはマネージドクロージャと全く同じよ"
"うに閉じ込める値をコピーしますが、値を所有します。つまり、他のコードは閉じ込"
"められた値にアクセスできなくなります。所有クロージャは並列プログラム、特に "
...
...
@@ -3666,11 +3666,11 @@ msgstr ""
#: doc/tutorial.md:1582
msgid ""
"`do` is a convenient way to create tasks with the `task::spawn` function. "
"`spawn` has the signature `spawn(fn:
~fn
())`. In other words, it is a "
"`spawn` has the signature `spawn(fn:
proc
())`. In other words, it is a "
"function that takes an owned closure that takes no arguments."
msgstr ""
"`task::spawn` 関数を用いてタスクを生成する場合、 `do` を用いると便利です。"
"`spawn` は、 `spawn(fn:
~fn
())` という方を持っています。言い換えると、"
"`spawn` は、 `spawn(fn:
proc
())` という方を持っています。言い換えると、"
"`spawn` は「引数をとらない所有クロージャ」を引数としてとる関数ということで"
"す。"
...
...
doc/po/tutorial-tasks.md.pot
浏览文件 @
ba739b21
...
...
@@ -213,7 +213,7 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:102
msgid ""
"The `spawn` function has a very simple type signature: `fn spawn(f:
~fn
())`. "
"The `spawn` function has a very simple type signature: `fn spawn(f:
proc
())`. "
"Because it accepts only owned closures, and owned closures contain only "
"owned data, `spawn` can safely move the entire closure and all its "
"associated state into an entirely different task for execution. Like any "
...
...
doc/po/tutorial.md.pot
浏览文件 @
ba739b21
...
...
@@ -2683,7 +2683,7 @@ msgstr ""
#. type: Plain text
#: doc/tutorial.md:1510
msgid ""
"Owned closures, written `
~fn` in analogy to the `~` pointer type
, hold on to "
"Owned closures, written `
proc`
, hold on to "
"things that can safely be sent between processes. They copy the values they "
"close over, much like managed closures, but they also own them: that is, no "
"other code can access them. Owned closures are used in concurrent code, "
...
...
@@ -2808,7 +2808,7 @@ msgstr ""
#: doc/tutorial.md:1582
msgid ""
"`do` is a convenient way to create tasks with the `task::spawn` function. "
"`spawn` has the signature `spawn(fn:
~fn
())`. In other words, it is a "
"`spawn` has the signature `spawn(fn:
proc
())`. In other words, it is a "
"function that takes an owned closure that takes no arguments."
msgstr ""
...
...
doc/tutorial-tasks.md
浏览文件 @
ba739b21
...
...
@@ -91,7 +91,7 @@ _owned types_. The language leaves the implementation details to the standard
library.
The
`spawn`
function has a very simple type signature:
`fn spawn(f:
~fn
())`
. Because it accepts only owned closures, and owned closures
proc
())`
. Because it accepts only owned closures, and owned closures
contain only owned data,
`spawn`
can safely move the entire closure
and all its associated state into an entirely different task for
execution. Like any closure, the function passed to
`spawn`
may capture
...
...
doc/tutorial.md
浏览文件 @
ba739b21
...
...
@@ -1409,7 +1409,7 @@ pervasively in Rust code.
## Owned closures
Owned closures, written
`
~fn`
in analogy to the
`~`
pointer type
,
Owned closures, written
`
proc`
,
hold on to things that can safely be sent between
processes. They copy the values they close over, much like managed
closures, but they also own them: that is, no other code can access
...
...
@@ -1484,7 +1484,7 @@ parentheses, where it looks more like a typical block of
code.
`do`
is a convenient way to create tasks with the
`task::spawn`
function.
`spawn`
has the signature
`spawn(fn:
~fn
())`
. In other
function.
`spawn`
has the signature
`spawn(fn:
proc
())`
. In other
words, it is a function that takes an owned closure that takes no
arguments.
...
...
src/libextra/task_pool.rs
浏览文件 @
ba739b21
...
...
@@ -97,7 +97,7 @@ pub fn execute(&mut self, f: proc(&T)) {
#[test]
fn
test_task_pool
()
{
let
f
:
proc
()
->
proc
(
uint
)
->
uint
=
||
{
let
f
:
&
fn
()
->
proc
(
uint
)
->
uint
=
||
{
let
g
:
proc
(
uint
)
->
uint
=
|
i
|
i
;
g
};
...
...
src/librustuv/net.rs
浏览文件 @
ba739b21
...
...
@@ -1101,7 +1101,7 @@ fn test_simple_homed_udp_io_bind_then_move_task_then_home_and_close() {
let
handle2
=
Cell
::
new
(
sched2
.make_handle
());
let
tasksFriendHandle
=
Cell
::
new
(
sched2
.make_handle
());
let
on_exit
:
~
fn
(
UnwindResult
)
=
|
exit_status
|
{
let
on_exit
:
proc
(
UnwindResult
)
=
|
exit_status
|
{
handle1
.take
()
.send
(
Shutdown
);
handle2
.take
()
.send
(
Shutdown
);
assert
!
(
exit_status
.is_success
());
...
...
@@ -1115,7 +1115,7 @@ unsafe fn local_io() -> &'static mut IoFactory {
}
}
let
test_function
:
~
fn
()
=
||
{
let
test_function
:
proc
()
=
||
{
let
io
=
unsafe
{
local_io
()
};
let
addr
=
next_test_ip4
();
let
maybe_socket
=
io
.udp_bind
(
addr
);
...
...
src/test/bench/task-perf-linked-failure.rs
浏览文件 @
ba739b21
...
...
@@ -53,7 +53,7 @@ fn grandchild_group(num_tasks: uint) {
// Master grandchild task exits early.
}
fn
spawn_supervised_blocking
(
myname
:
&
str
,
f
:
~
fn
())
{
fn
spawn_supervised_blocking
(
myname
:
&
str
,
f
:
proc
())
{
let
mut
builder
=
task
::
task
();
let
res
=
builder
.future_result
();
builder
.supervised
();
...
...
src/test/compile-fail/borrowck-call-sendfn.rs
浏览文件 @
ba739b21
...
...
@@ -11,7 +11,7 @@
// xfail-test #2978
struct
Foo
{
f
:
~
fn
()
f
:
proc
()
}
fn
call
(
x
:
@
Foo
)
{
...
...
src/test/compile-fail/borrowck-move-by-capture.rs
浏览文件 @
ba739b21
pub
fn
main
()
{
let
foo
=
~
3
;
let
_
pfoo
=
&
foo
;
let
_
f
:
~
fn
()
->
int
=
||
*
foo
+
5
;
//~^ ERROR cannot move `foo`
// FIXME(#2202) - Due to the way that borrowck treats closures,
// you get two error reports here.
let
bar
=
~
3
;
let
_
g
=
||
{
//~ ERROR capture of moved value
let
_
h
:
~
fn
()
->
int
=
||
*
bar
;
//~ ERROR capture of moved value
let
_
h
:
proc
()
->
int
=
||
*
bar
;
//~ ERROR capture of moved value
};
}
src/test/compile-fail/borrowck-move-moved-value-into-closure.rs
浏览文件 @
ba739b21
fn
call_f
(
f
:
~
fn
:
Send
()
->
int
)
->
int
{
fn
call_f
(
f
:
proc
()
->
int
)
->
int
{
f
()
}
...
...
src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs
浏览文件 @
ba739b21
...
...
@@ -9,10 +9,10 @@
// except according to those terms.
struct
X
{
field
:
~
fn
:
Send
(),
field
:
&
'static
fn
:
Send
(),
}
fn
foo
(
blk
:
~
fn
:())
->
X
{
fn
foo
(
blk
:
&
'static
fn
:())
->
X
{
return
X
{
field
:
blk
};
//~ ERROR expected bounds `Send` but found no bounds
}
...
...
src/test/compile-fail/kindck-nonsendable-1.rs
浏览文件 @
ba739b21
...
...
@@ -14,7 +14,7 @@ fn foo(_x: @uint) {}
fn
main
()
{
let
x
=
@
3u
;
let
_
:
~
fn
()
=
||
foo
(
x
);
//~ ERROR does not fulfill `Send`
let
_
:
~
fn
()
=
||
foo
(
x
);
//~ ERROR does not fulfill `Send`
let
_
:
~
fn
()
=
||
foo
(
x
);
//~ ERROR does not fulfill `Send`
let
_
:
proc
()
=
||
foo
(
x
);
//~ ERROR does not fulfill `Send`
let
_
:
proc
()
=
||
foo
(
x
);
//~ ERROR does not fulfill `Send`
let
_
:
proc
()
=
||
foo
(
x
);
//~ ERROR does not fulfill `Send`
}
src/test/compile-fail/kindck-send.rs
浏览文件 @
ba739b21
...
...
@@ -47,7 +47,7 @@ fn test<'a,T,U:Send>(_: &'a int) {
// but closure and object types can have lifetime bounds which make
// them not ok (FIXME #5121)
// assert_send::<
~fn
:'a()>(); // ERROR does not fulfill `Send`
// assert_send::<
proc
:'a()>(); // ERROR does not fulfill `Send`
// assert_send::<~Dummy:'a>(); // ERROR does not fulfill `Send`
// unsafe ptrs are ok unless they point at unsendable things
...
...
src/test/compile-fail/moves-sru-moved-field.rs
浏览文件 @
ba739b21
type
Noncopyable
=
~
fn
();
type
Noncopyable
=
proc
();
struct
Foo
{
copied
:
int
,
...
...
src/test/compile-fail/once-cant-move-out-of-non-once-on-heap.rs
已删除
100644 → 0
浏览文件 @
77f621bf
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Testing guarantees provided by once functions.
// This program would segfault if it were legal.
extern
mod
extra
;
use
extra
::
arc
;
use
std
::
util
;
fn
foo
(
blk
:
~
fn
())
{
blk
();
blk
();
}
fn
main
()
{
let
x
=
arc
::
Arc
::
new
(
true
);
do
foo
{
assert
!
(
*
x
.get
());
util
::
ignore
(
x
);
//~ ERROR cannot move out of captured outer variable
}
}
src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs
浏览文件 @
ba739b21
...
...
@@ -11,7 +11,7 @@
// check that the &int here does not cause us to think that `foo`
// contains region pointers
struct
foo
(
~
fn
(
x
:
&
int
));
struct
foo
(
proc
(
x
:
&
int
));
fn
take_foo
(
x
:
foo
<
'static
>
)
{}
//~ ERROR wrong number of lifetime parameters
...
...
src/test/debug-info/lexical-scope-in-unique-closure.rs
浏览文件 @
ba739b21
...
...
@@ -51,7 +51,7 @@ fn main() {
zzz
();
sentinel
();
let
unique_closure
:
~
fn
(
int
)
=
|
x
|
{
let
unique_closure
:
proc
(
int
)
=
|
x
|
{
zzz
();
sentinel
();
...
...
src/test/debug-info/var-captured-in-sendable-closure.rs
浏览文件 @
ba739b21
...
...
@@ -39,7 +39,7 @@ fn main() {
let
owned
=
~
5
;
let
closure
:
~
fn
()
=
||
{
let
closure
:
proc
()
=
||
{
zzz
();
do_something
(
&
constant
,
&
a_struct
.a
,
owned
);
};
...
...
src/test/pretty/fn-types.rs
浏览文件 @
ba739b21
...
...
@@ -12,5 +12,5 @@
fn
from_foreign_fn
(
_
x
:
fn
())
{
}
fn
from_stack_closure
(
_
x
:
||)
{
}
fn
from_unique_closure
(
_
x
:
~
fn
())
{
}
fn
from_unique_closure
(
_
x
:
proc
())
{
}
fn
main
()
{
}
src/test/run-fail/unwind-box-fn-unique.rs
浏览文件 @
ba739b21
...
...
@@ -18,7 +18,7 @@ fn failfn() {
fn
main
()
{
let
y
=
~
0
;
let
x
:
@
~
fn
()
=
@
(||
{
let
x
:
@
proc
()
=
@
(||
{
error!
(
"{:?}"
,
y
.clone
());
});
failfn
();
...
...
src/test/run-pass/block-arg-call-as.rs
浏览文件 @
ba739b21
...
...
@@ -10,7 +10,7 @@
extern
mod
extra
;
fn
asSendfn
(
f
:
~
fn
()
->
uint
)
->
uint
{
fn
asSendfn
(
f
:
proc
()
->
uint
)
->
uint
{
return
f
();
}
...
...
src/test/run-pass/borrowck-move-by-capture-ok.rs
浏览文件 @
ba739b21
pub
fn
main
()
{
let
bar
=
~
3
;
let
h
:
~
fn
()
->
int
=
||
*
bar
;
let
h
:
proc
()
->
int
=
||
*
bar
;
assert_eq!
(
h
(),
3
);
}
src/test/run-pass/cap-clause-move.rs
浏览文件 @
ba739b21
...
...
@@ -13,11 +13,11 @@
pub
fn
main
()
{
let
x
=
~
3
;
let
y
=
ptr
::
to_unsafe_ptr
(
&
(
*
x
))
as
uint
;
let
snd_move
:
~
fn
()
->
uint
=
||
ptr
::
to_unsafe_ptr
(
&
(
*
x
))
as
uint
;
let
snd_move
:
proc
()
->
uint
=
||
ptr
::
to_unsafe_ptr
(
&
(
*
x
))
as
uint
;
assert_eq!
(
snd_move
(),
y
);
let
x
=
~
4
;
let
y
=
ptr
::
to_unsafe_ptr
(
&
(
*
x
))
as
uint
;
let
lam_move
:
~
fn
()
->
uint
=
||
ptr
::
to_unsafe_ptr
(
&
(
*
x
))
as
uint
;
let
lam_move
:
proc
()
->
uint
=
||
ptr
::
to_unsafe_ptr
(
&
(
*
x
))
as
uint
;
assert_eq!
(
lam_move
(),
y
);
}
src/test/run-pass/clone-with-exterior.rs
浏览文件 @
ba739b21
...
...
@@ -19,7 +19,7 @@ struct Pair {
pub
fn
main
()
{
let
z
=
~
Pair
{
a
:
10
,
b
:
12
};
let
f
:
~
fn
()
=
||
{
let
f
:
proc
()
=
||
{
assert_eq!
(
z
.a
,
10
);
assert_eq!
(
z
.b
,
12
);
};
...
...
src/test/run-pass/closure-bounds-can-capture-chan.rs
浏览文件 @
ba739b21
...
...
@@ -10,7 +10,7 @@
use
std
::
comm
;
fn
foo
(
blk
:
~
fn
:
Send
())
{
fn
foo
(
blk
:
proc
())
{
blk
();
}
...
...
src/test/run-pass/explicit-self-generic.rs
浏览文件 @
ba739b21
...
...
@@ -15,8 +15,8 @@
*
* The hash should concentrate entropy in the lower bits.
*/
type
HashFn
<
K
>
=
~
fn
(
K
)
->
uint
;
type
EqFn
<
K
>
=
~
fn
(
K
,
K
)
->
bool
;
type
HashFn
<
K
>
=
proc
(
K
)
->
uint
;
type
EqFn
<
K
>
=
proc
(
K
,
K
)
->
bool
;
struct
LM
{
resize_at
:
uint
,
size
:
uint
}
...
...
src/test/run-pass/issue-2190-1.rs
浏览文件 @
ba739b21
...
...
@@ -11,7 +11,7 @@
// xfail-test
static
generations
:
uint
=
1024
+
256
+
128
+
49
;
fn
child_no
(
x
:
uint
)
->
~
fn
()
{
fn
child_no
(
x
:
uint
)
->
proc
()
{
||
{
if
x
<
generations
{
task
::
spawn
(
child_no
(
x
+
1
));
...
...
src/test/run-pass/issue-2190.rs
浏览文件 @
ba739b21
...
...
@@ -10,7 +10,7 @@
// xfail-test
type
t
=
{
f
:
~
fn
()
f
:
proc
()
};
pub
fn
main
()
{
...
...
src/test/run-pass/issue-3424.rs
浏览文件 @
ba739b21
...
...
@@ -17,7 +17,7 @@
use
std
::
path
;
use
std
::
result
;
type
rsrc_loader
=
~
fn
(
path
:
&
Path
)
->
result
::
Result
<~
str
,
~
str
>
;
type
rsrc_loader
=
proc
(
path
:
&
Path
)
->
result
::
Result
<~
str
,
~
str
>
;
fn
tester
()
{
...
...
src/test/run-pass/issue-3609.rs
浏览文件 @
ba739b21
...
...
@@ -4,7 +4,7 @@
use
std
::
task
;
type
RingBuffer
=
~
[
f64
];
type
SamplesFn
=
~
fn
(
samples
:
&
RingBuffer
);
type
SamplesFn
=
proc
(
samples
:
&
RingBuffer
);
enum
Msg
{
...
...
src/test/run-pass/issue-6141-leaking-owned-fn.rs
已删除
100644 → 0
浏览文件 @
77f621bf
fn
run
(
f
:
&
fn
())
{
f
()
}
pub
fn
main
()
{
let
f
:
~
fn
()
=
||
();
run
(
f
);
}
src/test/run-pass/newlambdas-ret-infer.rs
浏览文件 @
ba739b21
...
...
@@ -11,7 +11,7 @@
// Test that the lambda kind is inferred correctly as a return
// expression
fn
unique
()
->
~
fn
()
{
return
||
();
}
fn
unique
()
->
proc
()
{
return
||
();
}
pub
fn
main
()
{
}
src/test/run-pass/newlambdas-ret-infer2.rs
浏览文件 @
ba739b21
...
...
@@ -11,7 +11,7 @@
// Test that the lambda kind is inferred correctly as a return
// expression
fn
unique
()
->
~
fn
()
{
||
()
}
fn
unique
()
->
proc
()
{
||
()
}
pub
fn
main
()
{
}
src/test/run-pass/operator-overloading.rs
浏览文件 @
ba739b21
...
...
@@ -69,6 +69,6 @@ pub fn main() {
assert_eq!
(
q
.y
,
!
(
p
.y
));
// Issue #1733
let
result
:
~
fn
(
int
)
=
|
_
|();
let
result
:
proc
(
int
)
=
|
_
|();
result
(
p
[
true
]);
}
src/test/run-pass/sendfn-generic-fn.rs
已删除
100644 → 0
浏览文件 @
77f621bf
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// xfail-fast
use
std
::
task
;
pub
fn
main
()
{
test05
();
}
#[deriving(Clone)]
struct
Pair
<
A
,
B
>
{
a
:
A
,
b
:
B
,
}
fn
make_generic_record
<
A
,
B
>
(
a
:
A
,
b
:
B
)
->
Pair
<
A
,
B
>
{
return
Pair
{
a
:
a
,
b
:
b
};
}
fn
test05_start
(
f
:
&~
fn
(
v
:
f64
,
v
:
~
str
)
->
Pair
<
f64
,
~
str
>
)
{
let
p
=
(
*
f
)(
22.22
,
~
"Hi"
);
info!
(
"{:?}"
,
p
.clone
());
assert
!
(
p
.a
==
22.22
);
assert
!
(
p
.b
==
~
"Hi"
);
let
q
=
(
*
f
)(
44.44
,
~
"Ho"
);
info!
(
"{:?}"
,
q
.clone
());
assert
!
(
q
.a
==
44.44
);
assert
!
(
q
.b
==
~
"Ho"
);
}
fn
spawn
<
A
,
B
>
(
f
:
extern
fn
(
&~
fn
(
A
,
B
)
->
Pair
<
A
,
B
>
))
{
let
arg
:
~
fn
(
A
,
B
)
->
Pair
<
A
,
B
>
=
|
a
,
b
|
make_generic_record
(
a
,
b
);
task
::
spawn
(||
f
(
&
arg
));
}
fn
test05
()
{
spawn
::
<
f64
,
~
str
>
(
test05_start
);
}
src/test/run-pass/sendfn-spawn-with-fn-arg.rs
浏览文件 @
ba739b21
...
...
@@ -13,13 +13,13 @@
pub
fn
main
()
{
test05
();
}
fn
test05_start
(
f
:
~
fn
(
int
))
{
fn
test05_start
(
f
:
proc
(
int
))
{
f
(
22
);
}
fn
test05
()
{
let
three
=
~
3
;
let
fn_to_send
:
~
fn
(
int
)
=
|
n
|
{
let
fn_to_send
:
proc
(
int
)
=
|
n
|
{
error!
(
"{}"
,
*
three
+
n
);
// will copy x into the closure
assert_eq!
(
*
three
,
3
);
};
...
...
src/test/run-pass/swap-overlapping.rs
浏览文件 @
ba739b21
...
...
@@ -34,8 +34,8 @@ pub enum TestName {
}
pub
enum
TestFn
{
DynTestFn
(
~
fn
()),
DynBenchFn
(
~
fn
(
&
mut
int
))
DynTestFn
(
proc
()),
DynBenchFn
(
proc
(
&
mut
int
))
}
pub
struct
TestDesc
{
...
...
src/test/run-pass/task-killjoin-rsrc.rs
浏览文件 @
ba739b21
...
...
@@ -44,7 +44,7 @@ fn notify(ch: Chan<bool>, v: @mut bool) -> notify {
}
}
fn
joinable
(
f
:
~
fn
())
->
Port
<
bool
>
{
fn
joinable
(
f
:
proc
())
->
Port
<
bool
>
{
fn
wrapper
(
c
:
Chan
<
bool
>
,
f
:
&
fn
())
{
let
b
=
@
mut
false
;
error!
(
"wrapper: task=%? allocated v=%x"
,
...
...
src/test/run-pass/tempfile.rs
浏览文件 @
ba739b21
...
...
@@ -40,7 +40,7 @@ fn test_tempdir() {
fn
test_rm_tempdir
()
{
let
(
rd
,
wr
)
=
stream
();
let
f
:
~
fn
()
=
||
{
let
f
:
proc
()
=
||
{
let
tmp
=
TempDir
::
new
(
"test_rm_tempdir"
)
.unwrap
();
wr
.send
(
tmp
.path
()
.clone
());
fail
!
(
"fail to unwind past `tmp`"
);
...
...
@@ -52,7 +52,7 @@ fn test_rm_tempdir() {
let
tmp
=
TempDir
::
new
(
"test_rm_tempdir"
)
.unwrap
();
let
path
=
tmp
.path
()
.clone
();
let
cell
=
Cell
::
new
(
tmp
);
let
f
:
~
fn
()
=
||
{
let
f
:
proc
()
=
||
{
let
_
tmp
=
cell
.take
();
fail
!
(
"fail to unwind past `tmp`"
);
};
...
...
@@ -61,7 +61,7 @@ fn test_rm_tempdir() {
let
path
;
{
let
f
:
~
fn
()
->
TempDir
=
||
{
let
f
:
proc
()
->
TempDir
=
||
{
TempDir
::
new
(
"test_rm_tempdir"
)
.unwrap
()
};
let
tmp
=
task
::
try
(
f
)
.expect
(
"test_rm_tmdir"
);
...
...
src/test/run-pass/uniq-cc-generic.rs
浏览文件 @
ba739b21
...
...
@@ -19,11 +19,11 @@ enum maybe_pointy {
struct
Pointy
{
a
:
maybe_pointy
,
d
:
~
fn
()
->
uint
,
d
:
proc
()
->
uint
,
}
fn
make_uniq_closure
<
A
:
Send
>
(
a
:
A
)
->
~
fn
()
->
uint
{
let
result
:
~
fn
()
->
uint
=
||
ptr
::
to_unsafe_ptr
(
&
a
)
as
uint
;
fn
make_uniq_closure
<
A
:
Send
>
(
a
:
A
)
->
proc
()
->
uint
{
let
result
:
proc
()
->
uint
=
||
ptr
::
to_unsafe_ptr
(
&
a
)
as
uint
;
result
}
...
...
src/test/run-pass/uniq-cc.rs
浏览文件 @
ba739b21
...
...
@@ -18,7 +18,7 @@ enum maybe_pointy {
struct
Pointy
{
a
:
maybe_pointy
,
c
:
~
int
,
d
:
~
fn
()
->
(),
d
:
proc
()
->
(),
}
fn
empty_pointy
()
->
@
mut
Pointy
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录