diff --git a/doc/po/ja/tutorial-tasks.md.po b/doc/po/ja/tutorial-tasks.md.po index 9cea63f0d0b..2276d0052a6 100644 --- a/doc/po/ja/tutorial-tasks.md.po +++ b/doc/po/ja/tutorial-tasks.md.po @@ -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 " diff --git a/doc/po/ja/tutorial.md.po b/doc/po/ja/tutorial.md.po index 26dc7bf0db8..2b4e6e2c148 100644 --- a/doc/po/ja/tutorial.md.po +++ b/doc/po/ja/tutorial.md.po @@ -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` は「引数をとらない所有クロージャ」を引数としてとる関数ということで" "す。" diff --git a/doc/po/tutorial-tasks.md.pot b/doc/po/tutorial-tasks.md.pot index 483cde9d7d0..7a15fe19692 100644 --- a/doc/po/tutorial-tasks.md.pot +++ b/doc/po/tutorial-tasks.md.pot @@ -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 " diff --git a/doc/po/tutorial.md.pot b/doc/po/tutorial.md.pot index a9c93aa6a8b..86937652da9 100644 --- a/doc/po/tutorial.md.pot +++ b/doc/po/tutorial.md.pot @@ -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 "" diff --git a/doc/tutorial-tasks.md b/doc/tutorial-tasks.md index adde4ab17e6..d357e3b335e 100644 --- a/doc/tutorial-tasks.md +++ b/doc/tutorial-tasks.md @@ -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 diff --git a/doc/tutorial.md b/doc/tutorial.md index 1b414c40834..313d36e38bf 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -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. diff --git a/src/libextra/task_pool.rs b/src/libextra/task_pool.rs index 2ee3daacf80..64fb954764a 100644 --- a/src/libextra/task_pool.rs +++ b/src/libextra/task_pool.rs @@ -97,7 +97,7 @@ impl<T> TaskPool<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 }; diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs index dc6fbcec3f2..05f708355b0 100644 --- a/src/librustuv/net.rs +++ b/src/librustuv/net.rs @@ -1101,7 +1101,7 @@ mod test { 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 @@ mod test { } } - 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); diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs index 54a05c7257e..73ecd33bc7c 100644 --- a/src/test/bench/task-perf-linked-failure.rs +++ b/src/test/bench/task-perf-linked-failure.rs @@ -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(); diff --git a/src/test/compile-fail/borrowck-call-sendfn.rs b/src/test/compile-fail/borrowck-call-sendfn.rs index 8dc86c9a163..42dee384116 100644 --- a/src/test/compile-fail/borrowck-call-sendfn.rs +++ b/src/test/compile-fail/borrowck-call-sendfn.rs @@ -11,7 +11,7 @@ // xfail-test #2978 struct Foo { - f: ~fn() + f: proc() } fn call(x: @Foo) { diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs index 5994b9e85d5..aa50f9ac3fe 100644 --- a/src/test/compile-fail/borrowck-move-by-capture.rs +++ b/src/test/compile-fail/borrowck-move-by-capture.rs @@ -1,13 +1,8 @@ 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 }; } diff --git a/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs b/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs index 5e789e99c05..b6ad3ed95a4 100644 --- a/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs +++ b/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs @@ -1,4 +1,4 @@ -fn call_f(f: ~fn:Send() -> int) -> int { +fn call_f(f: proc() -> int) -> int { f() } diff --git a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs index 525f8f4a932..00eb31485b9 100644 --- a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs +++ b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs @@ -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 } diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs index 4472f042242..308eb637cd0 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -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` } diff --git a/src/test/compile-fail/kindck-send.rs b/src/test/compile-fail/kindck-send.rs index bb5851ac5c8..bfef15ea173 100644 --- a/src/test/compile-fail/kindck-send.rs +++ b/src/test/compile-fail/kindck-send.rs @@ -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 diff --git a/src/test/compile-fail/moves-sru-moved-field.rs b/src/test/compile-fail/moves-sru-moved-field.rs index 660e5596ca5..57c1cb5ecc6 100644 --- a/src/test/compile-fail/moves-sru-moved-field.rs +++ b/src/test/compile-fail/moves-sru-moved-field.rs @@ -1,4 +1,4 @@ -type Noncopyable = ~fn(); +type Noncopyable = proc(); struct Foo { copied: int, diff --git a/src/test/compile-fail/once-cant-move-out-of-non-once-on-heap.rs b/src/test/compile-fail/once-cant-move-out-of-non-once-on-heap.rs deleted file mode 100644 index cc40fb6b8d8..00000000000 --- a/src/test/compile-fail/once-cant-move-out-of-non-once-on-heap.rs +++ /dev/null @@ -1,29 +0,0 @@ -// 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 - } -} diff --git a/src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs b/src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs index 5c979955ec9..a743ff81b30 100644 --- a/src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs +++ b/src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs @@ -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 diff --git a/src/test/debug-info/lexical-scope-in-unique-closure.rs b/src/test/debug-info/lexical-scope-in-unique-closure.rs index 63a223a330b..da9220322dd 100644 --- a/src/test/debug-info/lexical-scope-in-unique-closure.rs +++ b/src/test/debug-info/lexical-scope-in-unique-closure.rs @@ -51,7 +51,7 @@ fn main() { zzz(); sentinel(); - let unique_closure: ~fn(int) = |x| { + let unique_closure: proc(int) = |x| { zzz(); sentinel(); diff --git a/src/test/debug-info/var-captured-in-sendable-closure.rs b/src/test/debug-info/var-captured-in-sendable-closure.rs index efc93d135a2..664e377c9fb 100644 --- a/src/test/debug-info/var-captured-in-sendable-closure.rs +++ b/src/test/debug-info/var-captured-in-sendable-closure.rs @@ -39,7 +39,7 @@ fn main() { let owned = ~5; - let closure: ~fn() = || { + let closure: proc() = || { zzz(); do_something(&constant, &a_struct.a, owned); }; diff --git a/src/test/pretty/fn-types.rs b/src/test/pretty/fn-types.rs index 27e56fb6074..ffa6f03909b 100644 --- a/src/test/pretty/fn-types.rs +++ b/src/test/pretty/fn-types.rs @@ -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() { } diff --git a/src/test/run-fail/unwind-box-fn-unique.rs b/src/test/run-fail/unwind-box-fn-unique.rs index 1f1b57aa704..b28a2a6f1f0 100644 --- a/src/test/run-fail/unwind-box-fn-unique.rs +++ b/src/test/run-fail/unwind-box-fn-unique.rs @@ -18,7 +18,7 @@ fn failfn() { fn main() { let y = ~0; - let x: @~fn() = @(|| { + let x: @proc() = @(|| { error!("{:?}", y.clone()); }); failfn(); diff --git a/src/test/run-pass/block-arg-call-as.rs b/src/test/run-pass/block-arg-call-as.rs index 6a59278982a..5aa28258792 100644 --- a/src/test/run-pass/block-arg-call-as.rs +++ b/src/test/run-pass/block-arg-call-as.rs @@ -10,7 +10,7 @@ extern mod extra; -fn asSendfn( f : ~fn()->uint ) -> uint { +fn asSendfn( f : proc()->uint ) -> uint { return f(); } diff --git a/src/test/run-pass/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck-move-by-capture-ok.rs index f6328c8c658..2f186cc3fba 100644 --- a/src/test/run-pass/borrowck-move-by-capture-ok.rs +++ b/src/test/run-pass/borrowck-move-by-capture-ok.rs @@ -1,5 +1,5 @@ pub fn main() { let bar = ~3; - let h: ~fn() -> int = || *bar; + let h: proc() -> int = || *bar; assert_eq!(h(), 3); } diff --git a/src/test/run-pass/cap-clause-move.rs b/src/test/run-pass/cap-clause-move.rs index 64be8dab6e7..c6227fdcc5e 100644 --- a/src/test/run-pass/cap-clause-move.rs +++ b/src/test/run-pass/cap-clause-move.rs @@ -13,11 +13,11 @@ use std::ptr; 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); } diff --git a/src/test/run-pass/clone-with-exterior.rs b/src/test/run-pass/clone-with-exterior.rs index f6a7856dccc..cceb0f353fb 100644 --- a/src/test/run-pass/clone-with-exterior.rs +++ b/src/test/run-pass/clone-with-exterior.rs @@ -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); }; diff --git a/src/test/run-pass/closure-bounds-can-capture-chan.rs b/src/test/run-pass/closure-bounds-can-capture-chan.rs index d35d6d9f07e..16c7eaf1037 100644 --- a/src/test/run-pass/closure-bounds-can-capture-chan.rs +++ b/src/test/run-pass/closure-bounds-can-capture-chan.rs @@ -10,7 +10,7 @@ use std::comm; -fn foo(blk: ~fn:Send()) { +fn foo(blk: proc()) { blk(); } diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs index 80e16af9228..023381949a3 100644 --- a/src/test/run-pass/explicit-self-generic.rs +++ b/src/test/run-pass/explicit-self-generic.rs @@ -15,8 +15,8 @@ extern mod extra; * * 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 } diff --git a/src/test/run-pass/issue-2190-1.rs b/src/test/run-pass/issue-2190-1.rs index f3a81771c21..0aaaa58fdd2 100644 --- a/src/test/run-pass/issue-2190-1.rs +++ b/src/test/run-pass/issue-2190-1.rs @@ -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)); diff --git a/src/test/run-pass/issue-2190.rs b/src/test/run-pass/issue-2190.rs index 05869952fb8..aeb4aad7d83 100644 --- a/src/test/run-pass/issue-2190.rs +++ b/src/test/run-pass/issue-2190.rs @@ -10,7 +10,7 @@ // xfail-test type t = { - f: ~fn() + f: proc() }; pub fn main() { diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index f860426ffd2..0b8fcdfbd84 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -17,7 +17,7 @@ use std::path::{Path}; 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() { diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 8ed70a7ee32..b283ba67d59 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -4,7 +4,7 @@ use std::comm::Chan; use std::task; type RingBuffer = ~[f64]; -type SamplesFn = ~fn(samples: &RingBuffer); +type SamplesFn = proc(samples: &RingBuffer); enum Msg { diff --git a/src/test/run-pass/issue-6141-leaking-owned-fn.rs b/src/test/run-pass/issue-6141-leaking-owned-fn.rs deleted file mode 100644 index 98d2ca5d942..00000000000 --- a/src/test/run-pass/issue-6141-leaking-owned-fn.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn run(f: &fn()) { - f() -} - -pub fn main() { - let f: ~fn() = || (); - run(f); -} diff --git a/src/test/run-pass/newlambdas-ret-infer.rs b/src/test/run-pass/newlambdas-ret-infer.rs index 6d6757890ad..e5844785a50 100644 --- a/src/test/run-pass/newlambdas-ret-infer.rs +++ b/src/test/run-pass/newlambdas-ret-infer.rs @@ -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() { } diff --git a/src/test/run-pass/newlambdas-ret-infer2.rs b/src/test/run-pass/newlambdas-ret-infer2.rs index 17ff8ce94d9..ccf1997498b 100644 --- a/src/test/run-pass/newlambdas-ret-infer2.rs +++ b/src/test/run-pass/newlambdas-ret-infer2.rs @@ -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() { } diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index 05aa1e74608..5dd8ea96d37 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -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]); } diff --git a/src/test/run-pass/sendfn-generic-fn.rs b/src/test/run-pass/sendfn-generic-fn.rs deleted file mode 100644 index d077db69c2a..00000000000 --- a/src/test/run-pass/sendfn-generic-fn.rs +++ /dev/null @@ -1,46 +0,0 @@ -// 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); -} diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index ecf1830864c..91bc8345845 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -13,13 +13,13 @@ use std::task; 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); }; diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index 5349d0554b1..986a9a8c49c 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -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 { diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index 10116e56946..395d6b0b51a 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -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", diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs index e8e3d337838..a1075345140 100644 --- a/src/test/run-pass/tempfile.rs +++ b/src/test/run-pass/tempfile.rs @@ -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"); diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs index f9a8efe5701..ada3607beae 100644 --- a/src/test/run-pass/uniq-cc-generic.rs +++ b/src/test/run-pass/uniq-cc-generic.rs @@ -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 } diff --git a/src/test/run-pass/uniq-cc.rs b/src/test/run-pass/uniq-cc.rs index e08d3965b17..fc58374d46d 100644 --- a/src/test/run-pass/uniq-cc.rs +++ b/src/test/run-pass/uniq-cc.rs @@ -18,7 +18,7 @@ enum maybe_pointy { struct Pointy { a : maybe_pointy, c : ~int, - d : ~fn()->(), + d : proc()->(), } fn empty_pointy() -> @mut Pointy {