Skip to content

Commit ba739b2

Browse files
committed
librustc: Convert ~fn() to proc() everywhere.
1 parent 77f621b commit ba739b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+57
-145
lines changed

doc/po/ja/tutorial-tasks.md.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ msgstr ""
213213
#. type: Plain text
214214
#: doc/tutorial-tasks.md:102
215215
msgid ""
216-
"The `spawn` function has a very simple type signature: `fn spawn(f: ~fn())`. "
216+
"The `spawn` function has a very simple type signature: `fn spawn(f: proc())`. "
217217
"Because it accepts only owned closures, and owned closures contain only "
218218
"owned data, `spawn` can safely move the entire closure and all its "
219219
"associated state into an entirely different task for execution. Like any "

doc/po/ja/tutorial.md.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,13 +3509,13 @@ msgstr "## 所有クロージャ"
35093509
#. type: Plain text
35103510
#: doc/tutorial.md:1510
35113511
msgid ""
3512-
"Owned closures, written `~fn` in analogy to the `~` pointer type, hold on to "
3512+
"Owned closures, written `proc`, hold on to "
35133513
"things that can safely be sent between processes. They copy the values they "
35143514
"close over, much like managed closures, but they also own them: that is, no "
35153515
"other code can access them. Owned closures are used in concurrent code, "
35163516
"particularly for spawning [tasks][tasks]."
35173517
msgstr ""
3518-
"`~` ポインタ型と同様に `~fn` 型 で書き表される所有クロージャは安全にプロセス"
3518+
"`~` `proc` で書き表される所有クロージャは安全にプロセス"
35193519
"間で送信することができます。所有クローじゃはマネージドクロージャと全く同じよ"
35203520
"うに閉じ込める値をコピーしますが、値を所有します。つまり、他のコードは閉じ込"
35213521
"められた値にアクセスできなくなります。所有クロージャは並列プログラム、特に "
@@ -3666,11 +3666,11 @@ msgstr ""
36663666
#: doc/tutorial.md:1582
36673667
msgid ""
36683668
"`do` is a convenient way to create tasks with the `task::spawn` function. "
3669-
"`spawn` has the signature `spawn(fn: ~fn())`. In other words, it is a "
3669+
"`spawn` has the signature `spawn(fn: proc())`. In other words, it is a "
36703670
"function that takes an owned closure that takes no arguments."
36713671
msgstr ""
36723672
"`task::spawn` 関数を用いてタスクを生成する場合、 `do` を用いると便利です。"
3673-
"`spawn` は、 `spawn(fn: ~fn())` という方を持っています。言い換えると、"
3673+
"`spawn` は、 `spawn(fn: proc())` という方を持っています。言い換えると、"
36743674
"`spawn` は「引数をとらない所有クロージャ」を引数としてとる関数ということで"
36753675
"す。"
36763676

doc/po/tutorial-tasks.md.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ msgstr ""
213213
#. type: Plain text
214214
#: doc/tutorial-tasks.md:102
215215
msgid ""
216-
"The `spawn` function has a very simple type signature: `fn spawn(f: ~fn())`. "
216+
"The `spawn` function has a very simple type signature: `fn spawn(f: proc())`. "
217217
"Because it accepts only owned closures, and owned closures contain only "
218218
"owned data, `spawn` can safely move the entire closure and all its "
219219
"associated state into an entirely different task for execution. Like any "

doc/po/tutorial.md.pot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,7 @@ msgstr ""
26832683
#. type: Plain text
26842684
#: doc/tutorial.md:1510
26852685
msgid ""
2686-
"Owned closures, written `~fn` in analogy to the `~` pointer type, hold on to "
2686+
"Owned closures, written `proc`, hold on to "
26872687
"things that can safely be sent between processes. They copy the values they "
26882688
"close over, much like managed closures, but they also own them: that is, no "
26892689
"other code can access them. Owned closures are used in concurrent code, "
@@ -2808,7 +2808,7 @@ msgstr ""
28082808
#: doc/tutorial.md:1582
28092809
msgid ""
28102810
"`do` is a convenient way to create tasks with the `task::spawn` function. "
2811-
"`spawn` has the signature `spawn(fn: ~fn())`. In other words, it is a "
2811+
"`spawn` has the signature `spawn(fn: proc())`. In other words, it is a "
28122812
"function that takes an owned closure that takes no arguments."
28132813
msgstr ""
28142814

doc/tutorial-tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ _owned types_. The language leaves the implementation details to the standard
9191
library.
9292

9393
The `spawn` function has a very simple type signature: `fn spawn(f:
94-
~fn())`. Because it accepts only owned closures, and owned closures
94+
proc())`. Because it accepts only owned closures, and owned closures
9595
contain only owned data, `spawn` can safely move the entire closure
9696
and all its associated state into an entirely different task for
9797
execution. Like any closure, the function passed to `spawn` may capture

doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ pervasively in Rust code.
14091409
14101410
## Owned closures
14111411
1412-
Owned closures, written `~fn` in analogy to the `~` pointer type,
1412+
Owned closures, written `proc`,
14131413
hold on to things that can safely be sent between
14141414
processes. They copy the values they close over, much like managed
14151415
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
14841484
code.
14851485
14861486
`do` is a convenient way to create tasks with the `task::spawn`
1487-
function. `spawn` has the signature `spawn(fn: ~fn())`. In other
1487+
function. `spawn` has the signature `spawn(fn: proc())`. In other
14881488
words, it is a function that takes an owned closure that takes no
14891489
arguments.
14901490

src/libextra/task_pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<T> TaskPool<T> {
9797

9898
#[test]
9999
fn test_task_pool() {
100-
let f: proc() -> proc(uint) -> uint = || {
100+
let f: &fn() -> proc(uint) -> uint = || {
101101
let g: proc(uint) -> uint = |i| i;
102102
g
103103
};

src/librustuv/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ mod test {
11011101
let handle2 = Cell::new(sched2.make_handle());
11021102
let tasksFriendHandle = Cell::new(sched2.make_handle());
11031103
1104-
let on_exit: ~fn(UnwindResult) = |exit_status| {
1104+
let on_exit: proc(UnwindResult) = |exit_status| {
11051105
handle1.take().send(Shutdown);
11061106
handle2.take().send(Shutdown);
11071107
assert!(exit_status.is_success());
@@ -1115,7 +1115,7 @@ mod test {
11151115
}
11161116
}
11171117
1118-
let test_function: ~fn() = || {
1118+
let test_function: proc() = || {
11191119
let io = unsafe { local_io() };
11201120
let addr = next_test_ip4();
11211121
let maybe_socket = io.udp_bind(addr);

src/test/bench/task-perf-linked-failure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn grandchild_group(num_tasks: uint) {
5353
// Master grandchild task exits early.
5454
}
5555

56-
fn spawn_supervised_blocking(myname: &str, f: ~fn()) {
56+
fn spawn_supervised_blocking(myname: &str, f: proc()) {
5757
let mut builder = task::task();
5858
let res = builder.future_result();
5959
builder.supervised();

src/test/compile-fail/borrowck-call-sendfn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// xfail-test #2978
1212

1313
struct Foo {
14-
f: ~fn()
14+
f: proc()
1515
}
1616

1717
fn call(x: @Foo) {
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
pub fn main() {
2-
let foo = ~3;
3-
let _pfoo = &foo;
4-
let _f: ~fn() -> int = || *foo + 5;
5-
//~^ ERROR cannot move `foo`
6-
72
// FIXME(#2202) - Due to the way that borrowck treats closures,
83
// you get two error reports here.
94
let bar = ~3;
105
let _g = || { //~ ERROR capture of moved value
11-
let _h: ~fn() -> int = || *bar; //~ ERROR capture of moved value
6+
let _h: proc() -> int = || *bar; //~ ERROR capture of moved value
127
};
138
}

src/test/compile-fail/borrowck-move-moved-value-into-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn call_f(f: ~fn:Send() -> int) -> int {
1+
fn call_f(f: proc() -> int) -> int {
22
f()
33
}
44

src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// except according to those terms.
1010

1111
struct X {
12-
field: ~fn:Send(),
12+
field: &'static fn:Send(),
1313
}
1414

15-
fn foo(blk: ~fn:()) -> X {
15+
fn foo(blk: &'static fn:()) -> X {
1616
return X { field: blk }; //~ ERROR expected bounds `Send` but found no bounds
1717
}
1818

src/test/compile-fail/kindck-nonsendable-1.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn foo(_x: @uint) {}
1414

1515
fn main() {
1616
let x = @3u;
17-
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Send`
18-
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Send`
19-
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Send`
17+
let _: proc() = || foo(x); //~ ERROR does not fulfill `Send`
18+
let _: proc() = || foo(x); //~ ERROR does not fulfill `Send`
19+
let _: proc() = || foo(x); //~ ERROR does not fulfill `Send`
2020
}

src/test/compile-fail/kindck-send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn test<'a,T,U:Send>(_: &'a int) {
4747

4848
// but closure and object types can have lifetime bounds which make
4949
// them not ok (FIXME #5121)
50-
// assert_send::<~fn:'a()>(); // ERROR does not fulfill `Send`
50+
// assert_send::<proc:'a()>(); // ERROR does not fulfill `Send`
5151
// assert_send::<~Dummy:'a>(); // ERROR does not fulfill `Send`
5252

5353
// unsafe ptrs are ok unless they point at unsendable things

src/test/compile-fail/moves-sru-moved-field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type Noncopyable = ~fn();
1+
type Noncopyable = proc();
22

33
struct Foo {
44
copied: int,

src/test/compile-fail/once-cant-move-out-of-non-once-on-heap.rs

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

src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// check that the &int here does not cause us to think that `foo`
1313
// contains region pointers
14-
struct foo(~fn(x: &int));
14+
struct foo(proc(x: &int));
1515

1616
fn take_foo(x: foo<'static>) {} //~ ERROR wrong number of lifetime parameters
1717

src/test/debug-info/lexical-scope-in-unique-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn main() {
5151
zzz();
5252
sentinel();
5353

54-
let unique_closure: ~fn(int) = |x| {
54+
let unique_closure: proc(int) = |x| {
5555
zzz();
5656
sentinel();
5757

src/test/debug-info/var-captured-in-sendable-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() {
3939

4040
let owned = ~5;
4141

42-
let closure: ~fn() = || {
42+
let closure: proc() = || {
4343
zzz();
4444
do_something(&constant, &a_struct.a, owned);
4545
};

src/test/pretty/fn-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
fn from_foreign_fn(_x: fn()) { }
1414
fn from_stack_closure(_x: ||) { }
15-
fn from_unique_closure(_x: ~fn()) { }
15+
fn from_unique_closure(_x: proc()) { }
1616
fn main() { }

src/test/run-fail/unwind-box-fn-unique.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn failfn() {
1818

1919
fn main() {
2020
let y = ~0;
21-
let x: @~fn() = @(|| {
21+
let x: @proc() = @(|| {
2222
error!("{:?}", y.clone());
2323
});
2424
failfn();

src/test/run-pass/block-arg-call-as.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
extern mod extra;
1212

13-
fn asSendfn( f : ~fn()->uint ) -> uint {
13+
fn asSendfn( f : proc()->uint ) -> uint {
1414
return f();
1515
}
1616

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub fn main() {
22
let bar = ~3;
3-
let h: ~fn() -> int = || *bar;
3+
let h: proc() -> int = || *bar;
44
assert_eq!(h(), 3);
55
}

src/test/run-pass/cap-clause-move.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use std::ptr;
1313
pub fn main() {
1414
let x = ~3;
1515
let y = ptr::to_unsafe_ptr(&(*x)) as uint;
16-
let snd_move: ~fn() -> uint = || ptr::to_unsafe_ptr(&(*x)) as uint;
16+
let snd_move: proc() -> uint = || ptr::to_unsafe_ptr(&(*x)) as uint;
1717
assert_eq!(snd_move(), y);
1818

1919
let x = ~4;
2020
let y = ptr::to_unsafe_ptr(&(*x)) as uint;
21-
let lam_move: ~fn() -> uint = || ptr::to_unsafe_ptr(&(*x)) as uint;
21+
let lam_move: proc() -> uint = || ptr::to_unsafe_ptr(&(*x)) as uint;
2222
assert_eq!(lam_move(), y);
2323
}

src/test/run-pass/clone-with-exterior.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct Pair {
1919
pub fn main() {
2020
let z = ~Pair { a : 10, b : 12};
2121

22-
let f: ~fn() = || {
22+
let f: proc() = || {
2323
assert_eq!(z.a, 10);
2424
assert_eq!(z.b, 12);
2525
};

src/test/run-pass/closure-bounds-can-capture-chan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use std::comm;
1212

13-
fn foo(blk: ~fn:Send()) {
13+
fn foo(blk: proc()) {
1414
blk();
1515
}
1616

src/test/run-pass/explicit-self-generic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ extern mod extra;
1515
*
1616
* The hash should concentrate entropy in the lower bits.
1717
*/
18-
type HashFn<K> = ~fn(K) -> uint;
19-
type EqFn<K> = ~fn(K, K) -> bool;
18+
type HashFn<K> = proc(K) -> uint;
19+
type EqFn<K> = proc(K, K) -> bool;
2020

2121
struct LM { resize_at: uint, size: uint }
2222

src/test/run-pass/issue-2190-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// xfail-test
1212
static generations: uint = 1024+256+128+49;
1313

14-
fn child_no(x: uint) -> ~fn() {
14+
fn child_no(x: uint) -> proc() {
1515
|| {
1616
if x < generations {
1717
task::spawn(child_no(x+1));

src/test/run-pass/issue-2190.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// xfail-test
1212
type t = {
13-
f: ~fn()
13+
f: proc()
1414
};
1515

1616
pub fn main() {

src/test/run-pass/issue-3424.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::path::{Path};
1717
use std::path;
1818
use std::result;
1919

20-
type rsrc_loader = ~fn(path: &Path) -> result::Result<~str, ~str>;
20+
type rsrc_loader = proc(path: &Path) -> result::Result<~str, ~str>;
2121

2222
fn tester()
2323
{

src/test/run-pass/issue-3609.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::comm::Chan;
44
use std::task;
55

66
type RingBuffer = ~[f64];
7-
type SamplesFn = ~fn(samples: &RingBuffer);
7+
type SamplesFn = proc(samples: &RingBuffer);
88

99
enum Msg
1010
{

src/test/run-pass/issue-6141-leaking-owned-fn.rs

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

src/test/run-pass/newlambdas-ret-infer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test that the lambda kind is inferred correctly as a return
1212
// expression
1313

14-
fn unique() -> ~fn() { return || (); }
14+
fn unique() -> proc() { return || (); }
1515

1616
pub fn main() {
1717
}

src/test/run-pass/newlambdas-ret-infer2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test that the lambda kind is inferred correctly as a return
1212
// expression
1313

14-
fn unique() -> ~fn() { || () }
14+
fn unique() -> proc() { || () }
1515

1616
pub fn main() {
1717
}

0 commit comments

Comments
 (0)