From 406813957b65a1627e9b26f73019868a7da1ae79 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 19 Nov 2013 16:34:19 -0800 Subject: [PATCH] test: Remove most uses of `&fn()` from the tests. --- src/test/auxiliary/cci_impl_lib.rs | 4 +-- src/test/auxiliary/cci_iter_lib.rs | 2 +- src/test/auxiliary/cci_no_inline_lib.rs | 2 +- src/test/bench/core-map.rs | 2 +- src/test/bench/core-set.rs | 25 +++++++------ src/test/bench/core-std.rs | 2 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 3 +- src/test/bench/shootout-k-nucleotide.rs | 2 +- .../compile-fail/access-mode-in-closures.rs | 2 +- src/test/compile-fail/block-coerce-no-2.rs | 2 +- src/test/compile-fail/block-coerce-no.rs | 6 ++-- .../compile-fail/borrowck-assign-comp-idx.rs | 2 +- .../compile-fail/borrowck-autoref-3261.rs | 2 +- .../borrowck-insert-during-each.rs | 2 +- .../compile-fail/borrowck-lend-flow-if.rs | 2 +- .../compile-fail/borrowck-lend-flow-loop.rs | 4 +-- src/test/compile-fail/borrowck-lend-flow.rs | 2 +- .../borrowck-loan-blocks-move-cc.rs | 2 +- .../borrowck-loan-blocks-mut-uniq.rs | 2 +- src/test/compile-fail/borrowck-loan-rcvr.rs | 4 +-- .../compile-fail/borrowck-loan-vec-content.rs | 2 +- .../borrowck-move-in-irrefut-pat.rs | 2 +- .../closure-bounds-not-builtin.rs | 2 +- ...ure-bounds-static-cant-capture-borrowed.rs | 2 +- .../compile-fail/closure-bounds-subtype.rs | 8 ++--- src/test/compile-fail/closure-that-fails.rs | 2 +- src/test/compile-fail/do2.rs | 2 +- .../compile-fail/extern-wrong-value-type.rs | 2 +- src/test/compile-fail/fn-variance-1.rs | 2 +- .../compile-fail/immut-function-arguments.rs | 2 +- src/test/compile-fail/issue-2074.rs | 4 +-- src/test/compile-fail/issue-2149.rs | 4 +-- src/test/compile-fail/issue-5216.rs | 4 +-- src/test/compile-fail/issue-5239-1.rs | 2 +- src/test/compile-fail/issue-6762.rs | 11 +++--- src/test/compile-fail/issue-7573.rs | 2 +- src/test/compile-fail/kindck-freeze.rs | 2 +- .../compile-fail/lint-unused-mut-variables.rs | 2 +- src/test/compile-fail/lint-unused-unsafe.rs | 2 +- src/test/compile-fail/liveness-block-unint.rs | 2 +- .../liveness-closure-require-ret.rs | 2 +- .../liveness-init-in-called-fn-expr.rs | 2 +- .../compile-fail/liveness-init-in-fn-expr.rs | 2 +- src/test/compile-fail/missing-do.rs | 2 +- .../moves-based-on-type-block-bad.rs | 2 +- ...ased-on-type-no-recursive-stack-closure.rs | 2 +- .../compile-fail/omitted-arg-wrong-types.rs | 2 +- ...once-cant-move-out-of-non-once-on-stack.rs | 2 +- src/test/compile-fail/once-fn-subtyping.rs | 4 +-- src/test/compile-fail/qquote-1.rs | 2 +- src/test/compile-fail/qquote-2.rs | 2 +- .../regionck-closure-lifetimes.rs | 4 +-- .../compile-fail/regions-creating-enums.rs | 2 +- .../compile-fail/regions-escape-bound-fn-2.rs | 2 +- .../compile-fail/regions-escape-bound-fn.rs | 2 +- .../regions-escape-via-trait-or-not.rs | 2 +- src/test/compile-fail/regions-fn-bound.rs | 16 ++++----- src/test/compile-fail/regions-fn-subtyping.rs | 36 +++++++++---------- src/test/compile-fail/regions-fns.rs | 2 +- .../regions-free-region-ordering-callee.rs | 2 +- .../regions-free-region-ordering-caller.rs | 2 +- .../regions-infer-borrow-scope-within-loop.rs | 2 +- src/test/compile-fail/regions-infer-call-3.rs | 2 +- .../compile-fail/regions-name-undeclared.rs | 12 +++---- src/test/compile-fail/regions-nested-fns-2.rs | 2 +- src/test/compile-fail/regions-nested-fns.rs | 4 +-- .../compile-fail/regions-ref-in-fn-arg.rs | 2 +- .../compile-fail/regions-ret-borrowed-1.rs | 2 +- src/test/compile-fail/regions-ret-borrowed.rs | 2 +- .../compile-fail/type-arg-out-of-scope.rs | 2 +- .../lexical-scope-in-stack-closure.rs | 2 +- src/test/run-fail/unwind-iter.rs | 2 +- src/test/run-fail/unwind-iter2.rs | 2 +- src/test/run-fail/unwind-lambda.rs | 4 +-- src/test/run-pass-fulldeps/qquote.rs | 2 +- src/test/run-pass/argument-passing.rs | 2 +- src/test/run-pass/assignability-trait.rs | 6 ++-- src/test/run-pass/autobind.rs | 4 +-- src/test/run-pass/block-arg-call-as.rs | 4 +-- .../block-arg-can-be-followed-by-block-arg.rs | 2 +- src/test/run-pass/block-arg-used-as-any.rs | 2 +- src/test/run-pass/block-explicit-types.rs | 2 +- src/test/run-pass/block-fn-coerce.rs | 2 +- src/test/run-pass/block-iter-1.rs | 2 +- src/test/run-pass/block-iter-2.rs | 2 +- .../borrowck-borrow-from-expr-block.rs | 2 +- src/test/run-pass/borrowck-mut-uniq.rs | 2 +- .../borrowck-preserve-box-in-field.rs | 2 +- .../run-pass/borrowck-preserve-box-in-uniq.rs | 2 +- src/test/run-pass/borrowck-preserve-box.rs | 2 +- .../run-pass/borrowck-preserve-expl-deref.rs | 2 +- src/test/run-pass/closure-inference.rs | 2 +- src/test/run-pass/do-empty-args.rs | 2 +- src/test/run-pass/do-no-args.rs | 4 +-- src/test/run-pass/do-pure.rs | 2 +- src/test/run-pass/do-stack.rs | 2 +- src/test/run-pass/do1.rs | 2 +- src/test/run-pass/do2.rs | 2 +- src/test/run-pass/do3.rs | 2 +- src/test/run-pass/fn-bare-coerce-to-block.rs | 2 +- src/test/run-pass/fn-pattern-expected-type.rs | 2 +- src/test/run-pass/fn-type-infer.rs | 2 +- src/test/run-pass/foreach-nested.rs | 2 +- src/test/run-pass/foreach-put-structured.rs | 2 +- .../run-pass/foreach-simple-outer-slot.rs | 2 +- src/test/run-pass/fun-call-variants.rs | 2 +- src/test/run-pass/generic-static-methods.rs | 4 +-- src/test/run-pass/issue-1458.rs | 4 +-- src/test/run-pass/issue-2185.rs | 30 ++++++++-------- src/test/run-pass/issue-2190-2.rs | 6 ++-- src/test/run-pass/issue-2487-a.rs | 2 +- src/test/run-pass/issue-3429.rs | 2 +- src/test/run-pass/issue-3796.rs | 2 +- src/test/run-pass/issue-3874.rs | 2 +- src/test/run-pass/issue-3904.rs | 2 +- src/test/run-pass/issue-5239-2.rs | 2 +- src/test/run-pass/issue-6153.rs | 2 +- src/test/run-pass/issue-868.rs | 2 +- src/test/run-pass/iter-range.rs | 2 +- src/test/run-pass/lambda-infer-unresolved.rs | 4 +-- src/test/run-pass/last-use-in-block.rs | 6 ++-- src/test/run-pass/last-use-is-capture.rs | 2 +- src/test/run-pass/match-phi.rs | 2 +- src/test/run-pass/monad.rs | 8 ++--- src/test/run-pass/move-nullary-fn.rs | 4 +-- src/test/run-pass/mut-function-arguments.rs | 2 +- src/test/run-pass/newlambdas.rs | 4 +-- src/test/run-pass/non-legacy-modes.rs | 2 +- src/test/run-pass/purity-infer.rs | 2 +- src/test/run-pass/reflect-visit-data.rs | 6 ++-- src/test/run-pass/regions-fn-subtyping-2.rs | 4 +-- src/test/run-pass/regions-fn-subtyping.rs | 8 ++--- src/test/run-pass/regions-infer-call-2.rs | 2 +- src/test/run-pass/regions-params.rs | 2 +- src/test/run-pass/sendfn-is-a-block.rs | 2 +- src/test/run-pass/static-impl.rs | 12 +++---- src/test/run-pass/task-killjoin-rsrc.rs | 2 +- src/test/run-pass/tempfile.rs | 2 +- src/test/run-pass/trait-bounds-in-arc.rs | 8 ++--- src/test/run-pass/trait-generic.rs | 4 +-- src/test/run-pass/type-params-in-for-each.rs | 2 +- src/test/run-pass/unnamed_argument_mode.rs | 2 +- src/test/run-pass/unused-move-capture.rs | 2 +- src/test/run-pass/variadic-ffi.rs | 2 +- src/test/run-pass/vec-matching-fold.rs | 4 +-- 145 files changed, 249 insertions(+), 256 deletions(-) diff --git a/src/test/auxiliary/cci_impl_lib.rs b/src/test/auxiliary/cci_impl_lib.rs index aebe9382f64..f038acf67a8 100644 --- a/src/test/auxiliary/cci_impl_lib.rs +++ b/src/test/auxiliary/cci_impl_lib.rs @@ -11,12 +11,12 @@ #[link(name="cci_impl_lib", vers="0.0")]; trait uint_helpers { - fn to(&self, v: uint, f: &fn(uint)); + fn to(&self, v: uint, f: |uint|); } impl uint_helpers for uint { #[inline] - fn to(&self, v: uint, f: &fn(uint)) { + fn to(&self, v: uint, f: |uint|) { let mut i = *self; while i < v { f(i); diff --git a/src/test/auxiliary/cci_iter_lib.rs b/src/test/auxiliary/cci_iter_lib.rs index a264c7d238f..e08a2f7fcbb 100644 --- a/src/test/auxiliary/cci_iter_lib.rs +++ b/src/test/auxiliary/cci_iter_lib.rs @@ -11,7 +11,7 @@ #[link(name="cci_iter_lib", vers="0.0")]; #[inline] -pub fn iter(v: &[T], f: &fn(&T)) { +pub fn iter(v: &[T], f: |&T|) { let mut i = 0u; let n = v.len(); while i < n { diff --git a/src/test/auxiliary/cci_no_inline_lib.rs b/src/test/auxiliary/cci_no_inline_lib.rs index fbdb7806b5e..99d13e91752 100644 --- a/src/test/auxiliary/cci_no_inline_lib.rs +++ b/src/test/auxiliary/cci_no_inline_lib.rs @@ -11,7 +11,7 @@ #[link(name="cci_no_inline_lib", vers="0.0")]; // same as cci_iter_lib, more-or-less, but not marked inline -pub fn iter(v: ~[uint], f: &fn(uint)) { +pub fn iter(v: ~[uint], f: |uint|) { let mut i = 0u; let n = v.len(); while i < n { diff --git a/src/test/bench/core-map.rs b/src/test/bench/core-map.rs index 37efa5768af..3cfe615b9c0 100644 --- a/src/test/bench/core-map.rs +++ b/src/test/bench/core-map.rs @@ -19,7 +19,7 @@ use std::uint; use std::vec; -fn timed(label: &str, f: &fn()) { +fn timed(label: &str, f: ||) { let start = time::precise_time_s(); f(); let end = time::precise_time_s(); diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index 9f65dc1e555..f9a3618d2ab 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -27,7 +27,7 @@ struct Results { delete_strings: f64 } -fn timed(result: &mut f64, op: &fn()) { +fn timed(result: &mut f64, op: ||) { let start = extra::time::precise_time_s(); op(); let end = extra::time::precise_time_s(); @@ -36,13 +36,12 @@ fn timed(result: &mut f64, op: &fn()) { impl Results { pub fn bench_int, - R: rand::Rng>( - &mut self, - rng: &mut R, - num_keys: uint, - rand_cap: uint, - f: &fn() -> T) { - { + R: rand::Rng>( + &mut self, + rng: &mut R, + num_keys: uint, + rand_cap: uint, + f: || -> T) { { let mut set = f(); do timed(&mut self.sequential_ints) { for i in range(0u, num_keys) { @@ -79,11 +78,11 @@ pub fn bench_int, } pub fn bench_str, - R:rand::Rng>( - &mut self, - rng: &mut R, - num_keys: uint, - f: &fn() -> T) { + R:rand::Rng>( + &mut self, + rng: &mut R, + num_keys: uint, + f: || -> T) { { let mut set = f(); do timed(&mut self.sequential_strings) { diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 4f1e2672575..c7036f8d9db 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -40,7 +40,7 @@ fn main() { bench!(argv, is_utf8_multibyte); } -fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) { +fn maybe_run_test(argv: &[~str], name: ~str, test: ||) { let mut run_test = false; if os::getenv("RUST_BENCH").is_some() { diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 7becdee43a4..853b4eaba9d 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -104,8 +104,7 @@ fn update_freq(mm: &mut HashMap<~[u8], uint>, key: &[u8]) { // given a ~[u8], for each window call a function // i.e., for "hello" and windows of size four, // run it("hell") and it("ello"), then return "llo" -fn windows_with_carry(bb: &[u8], nn: uint, - it: &fn(window: &[u8])) -> ~[u8] { +fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> ~[u8] { let mut ii = 0u; let len = bb.len(); diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index f2ba0d40ebc..f8ac5154e7b 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -154,7 +154,7 @@ fn lookup(&mut self, key: Code, c: C) { } } - fn each(&self, f: &fn(entry: &Entry) -> bool) { + fn each(&self, f: |entry: &Entry| -> bool) { for self.items.each |item| { match *item { None => {} diff --git a/src/test/compile-fail/access-mode-in-closures.rs b/src/test/compile-fail/access-mode-in-closures.rs index 61fb754f761..ef853f57ef5 100644 --- a/src/test/compile-fail/access-mode-in-closures.rs +++ b/src/test/compile-fail/access-mode-in-closures.rs @@ -11,7 +11,7 @@ struct sty(~[int]); -fn unpack(_unpack: &fn(v: &sty) -> ~[int]) {} +fn unpack(_unpack: |v: &sty| -> ~[int]) {} fn main() { let _foo = unpack(|s| { diff --git a/src/test/compile-fail/block-coerce-no-2.rs b/src/test/compile-fail/block-coerce-no-2.rs index 3e38ce9ab35..52359bed59c 100644 --- a/src/test/compile-fail/block-coerce-no-2.rs +++ b/src/test/compile-fail/block-coerce-no-2.rs @@ -15,7 +15,7 @@ fn main() { fn f(f: extern fn(extern fn(extern fn()))) { } - fn g(f: extern fn(&fn())) { + fn g(f: extern fn(||)) { } f(g); diff --git a/src/test/compile-fail/block-coerce-no.rs b/src/test/compile-fail/block-coerce-no.rs index 71afba18bb1..d07c3feb194 100644 --- a/src/test/compile-fail/block-coerce-no.rs +++ b/src/test/compile-fail/block-coerce-no.rs @@ -11,9 +11,9 @@ // Make sure that fn-to-block coercion isn't incorrectly lifted over // other tycons. -fn coerce(b: &fn()) -> extern fn() { - fn lol(f: extern fn(v: &fn()) -> extern fn(), - g: &fn()) -> extern fn() { return f(g); } +fn coerce(b: ||) -> extern fn() { + fn lol(f: extern fn(v: ||) -> extern fn(), + g: ||) -> extern fn() { return f(g); } fn fn_id(f: extern fn()) -> extern fn() { return f } return lol(fn_id, b); //~^ ERROR mismatched types diff --git a/src/test/compile-fail/borrowck-assign-comp-idx.rs b/src/test/compile-fail/borrowck-assign-comp-idx.rs index 81e16b6b615..55ef70ad852 100644 --- a/src/test/compile-fail/borrowck-assign-comp-idx.rs +++ b/src/test/compile-fail/borrowck-assign-comp-idx.rs @@ -24,7 +24,7 @@ fn a() { info!("{}", *q); } -fn borrow(_x: &[int], _f: &fn()) {} +fn borrow(_x: &[int], _f: ||) {} fn b() { // here we alias the mutable vector into an imm slice and try to diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs index 4bbd1b0decf..f834642eb3c 100644 --- a/src/test/compile-fail/borrowck-autoref-3261.rs +++ b/src/test/compile-fail/borrowck-autoref-3261.rs @@ -11,7 +11,7 @@ struct X(Either<(uint,uint),extern fn()>); impl X { - pub fn with(&self, blk: &fn(x: &Either<(uint,uint),extern fn()>)) { + pub fn with(&self, blk: |x: &Either<(uint,uint),extern fn()>|) { blk(&**self) } } diff --git a/src/test/compile-fail/borrowck-insert-during-each.rs b/src/test/compile-fail/borrowck-insert-during-each.rs index e507f0e9e5b..358305aee08 100644 --- a/src/test/compile-fail/borrowck-insert-during-each.rs +++ b/src/test/compile-fail/borrowck-insert-during-each.rs @@ -15,7 +15,7 @@ struct Foo { } impl Foo { - pub fn foo(&mut self, fun: &fn(&int)) { + pub fn foo(&mut self, fun: |&int|) { for f in self.n.iter() { fun(f); } diff --git a/src/test/compile-fail/borrowck-lend-flow-if.rs b/src/test/compile-fail/borrowck-lend-flow-if.rs index 563f63b98be..80b8770397f 100644 --- a/src/test/compile-fail/borrowck-lend-flow-if.rs +++ b/src/test/compile-fail/borrowck-lend-flow-if.rs @@ -17,7 +17,7 @@ fn borrow(_v: &int) {} fn borrow_mut(_v: &mut int) {} fn cond() -> bool { fail!() } -fn for_func(_f: &fn() -> bool) { fail!() } +fn for_func(_f: || -> bool) { fail!() } fn produce() -> T { fail!(); } fn inc(v: &mut ~int) { diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs index 9286340f6c9..14994c0245d 100644 --- a/src/test/compile-fail/borrowck-lend-flow-loop.rs +++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs @@ -111,7 +111,7 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) { } } -fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) { +fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: |&'r mut uint| -> bool) { // Here we check that when you break out of an inner loop, the // borrows that go out of scope as you exit the inner loop are // removed from the bitset. @@ -127,7 +127,7 @@ fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) } } -fn loop_loop_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) { +fn loop_loop_pops_scopes<'r>(_v: &'r mut [uint], f: |&'r mut uint| -> bool) { // Similar to `loop_break_pops_scopes` but for the `loop` keyword while cond() { diff --git a/src/test/compile-fail/borrowck-lend-flow.rs b/src/test/compile-fail/borrowck-lend-flow.rs index ea840a28b4e..5e4e5bb1e73 100644 --- a/src/test/compile-fail/borrowck-lend-flow.rs +++ b/src/test/compile-fail/borrowck-lend-flow.rs @@ -17,7 +17,7 @@ fn borrow(_v: &int) {} fn borrow_mut(_v: &mut int) {} fn cond() -> bool { fail!() } -fn for_func(_f: &fn() -> bool) { fail!() } +fn for_func(_f: || -> bool) { fail!() } fn produce() -> T { fail!(); } fn inc(v: &mut ~int) { diff --git a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs index 0284f234d9a..7a226b8b67c 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs @@ -10,7 +10,7 @@ use std::task; -fn borrow(v: &int, f: &fn(x: &int)) { +fn borrow(v: &int, f: |x: &int|) { f(v); } diff --git a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs index ae8779eafcc..417330b6864 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn borrow(v: &int, f: &fn(x: &int)) { +fn borrow(v: &int, f: |x: &int|) { f(v); } diff --git a/src/test/compile-fail/borrowck-loan-rcvr.rs b/src/test/compile-fail/borrowck-loan-rcvr.rs index 27a66557434..e04eaa4d7af 100644 --- a/src/test/compile-fail/borrowck-loan-rcvr.rs +++ b/src/test/compile-fail/borrowck-loan-rcvr.rs @@ -12,14 +12,14 @@ struct point { x: int, y: int } trait methods { fn impurem(&self); - fn blockm(&self, f: &fn()); + fn blockm(&self, f: ||); } impl methods for point { fn impurem(&self) { } - fn blockm(&self, f: &fn()) { f() } + fn blockm(&self, f: ||) { f() } } fn a() { diff --git a/src/test/compile-fail/borrowck-loan-vec-content.rs b/src/test/compile-fail/borrowck-loan-vec-content.rs index 8a4a2cdedb2..0617d199191 100644 --- a/src/test/compile-fail/borrowck-loan-vec-content.rs +++ b/src/test/compile-fail/borrowck-loan-vec-content.rs @@ -12,7 +12,7 @@ // (locally rooted) mutable, unique vector, and that we then prevent // modifications to the contents. -fn takes_imm_elt(_v: &int, f: &fn()) { +fn takes_imm_elt(_v: &int, f: ||) { f(); } diff --git a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs index 628ccd1a5d7..7615036300f 100644 --- a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs +++ b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs @@ -1,4 +1,4 @@ -fn with(f: &fn(&~str)) {} +fn with(f: |&~str|) {} fn arg_item(&_x: &~str) {} //~^ ERROR cannot move out of dereference of & pointer diff --git a/src/test/compile-fail/closure-bounds-not-builtin.rs b/src/test/compile-fail/closure-bounds-not-builtin.rs index fbf1acb6066..4afab8db546 100644 --- a/src/test/compile-fail/closure-bounds-not-builtin.rs +++ b/src/test/compile-fail/closure-bounds-not-builtin.rs @@ -1,7 +1,7 @@ trait Foo {} -fn take(f: &fn:Foo()) { +fn take(f: ||:Foo) { //~^ ERROR only the builtin traits can be used as closure or object bounds } diff --git a/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs b/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs index cac1244a560..8fb64ee6dac 100644 --- a/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs +++ b/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn bar(blk: &fn:'static()) { +fn bar(blk: ||:'static) { } fn foo(x: &()) { diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/compile-fail/closure-bounds-subtype.rs index f04da0575b9..77281b26554 100644 --- a/src/test/compile-fail/closure-bounds-subtype.rs +++ b/src/test/compile-fail/closure-bounds-subtype.rs @@ -1,15 +1,15 @@ -fn take_any(_: &fn:()) { +fn take_any(_: ||:) { } -fn take_const_owned(_: &fn:Freeze+Send()) { +fn take_const_owned(_: ||:Freeze+Send) { } -fn give_any(f: &fn:()) { +fn give_any(f: ||:) { take_any(f); } -fn give_owned(f: &fn:Send()) { +fn give_owned(f: ||:Send) { take_any(f); take_const_owned(f); //~ ERROR expected bounds `Send+Freeze` but found bounds `Send` } diff --git a/src/test/compile-fail/closure-that-fails.rs b/src/test/compile-fail/closure-that-fails.rs index aad0e8bcbb6..fc8e2d4d853 100644 --- a/src/test/compile-fail/closure-that-fails.rs +++ b/src/test/compile-fail/closure-that-fails.rs @@ -1,4 +1,4 @@ -fn foo(f: &fn() -> !) {} +fn foo(f: || -> !) {} fn main() { // Type inference didn't use to be able to handle this: diff --git a/src/test/compile-fail/do2.rs b/src/test/compile-fail/do2.rs index 1bffdaa682c..ffb779da354 100644 --- a/src/test/compile-fail/do2.rs +++ b/src/test/compile-fail/do2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(f: &fn(int) -> bool) -> bool { f(10i) } +fn f(f: |int| -> bool) -> bool { f(10i) } fn main() { assert!(do f() |i| { i == 10i } == 10i); diff --git a/src/test/compile-fail/extern-wrong-value-type.rs b/src/test/compile-fail/extern-wrong-value-type.rs index 069c5a77c6c..6b01b83db21 100644 --- a/src/test/compile-fail/extern-wrong-value-type.rs +++ b/src/test/compile-fail/extern-wrong-value-type.rs @@ -14,5 +14,5 @@ fn main() { // extern functions are extern "C" fn let _x: extern "C" fn() = f; // OK - let _x: &fn() = f; //~ ERROR mismatched types + let _x: || = f; //~ ERROR mismatched types } diff --git a/src/test/compile-fail/fn-variance-1.rs b/src/test/compile-fail/fn-variance-1.rs index dd14d89a380..a4ebfef1774 100644 --- a/src/test/compile-fail/fn-variance-1.rs +++ b/src/test/compile-fail/fn-variance-1.rs @@ -13,7 +13,7 @@ fn takes_mut(x: @mut int) { } fn takes_imm(x: @int) { } -fn apply(t: T, f: &fn(T)) { +fn apply(t: T, f: |T|) { f(t) } diff --git a/src/test/compile-fail/immut-function-arguments.rs b/src/test/compile-fail/immut-function-arguments.rs index 66b5bd172ca..663a50e9e55 100644 --- a/src/test/compile-fail/immut-function-arguments.rs +++ b/src/test/compile-fail/immut-function-arguments.rs @@ -13,7 +13,7 @@ fn f(y: ~int) { } fn g() { - let _frob: &fn(~int) = |q| { *q = 2; }; //~ ERROR cannot assign + let _frob: |~int| = |q| { *q = 2; }; //~ ERROR cannot assign } diff --git a/src/test/compile-fail/issue-2074.rs b/src/test/compile-fail/issue-2074.rs index 7815fca16c6..3b8c552db2b 100644 --- a/src/test/compile-fail/issue-2074.rs +++ b/src/test/compile-fail/issue-2074.rs @@ -10,11 +10,11 @@ // xfail-test fn main() { - let one: &fn() -> uint = || { + let one: || -> uint = || { enum r { a }; a as uint }; - let two = &fn() -> uint = || { + let two = || -> uint = || { enum r { a }; a as uint }; diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs index 3da01c6fb01..8d2bdd2d2eb 100644 --- a/src/test/compile-fail/issue-2149.rs +++ b/src/test/compile-fail/issue-2149.rs @@ -9,11 +9,11 @@ // except according to those terms. trait vec_monad { - fn bind(&self, f: &fn(A) -> ~[B]); + fn bind(&self, f: |A| -> ~[B]); } impl vec_monad for ~[A] { - fn bind(&self, f: &fn(A) -> ~[B]) { + fn bind(&self, f: |A| -> ~[B]) { let mut r = fail!(); for elt in self.iter() { r = r + f(*elt); } //~^ ERROR the type of this value must be known diff --git a/src/test/compile-fail/issue-5216.rs b/src/test/compile-fail/issue-5216.rs index 8205a6dae64..ec9ec9565c4 100644 --- a/src/test/compile-fail/issue-5216.rs +++ b/src/test/compile-fail/issue-5216.rs @@ -9,12 +9,12 @@ // except according to those terms. fn f() { } -struct S(&fn()); //~ ERROR missing lifetime specifier +struct S(||); //~ ERROR missing lifetime specifier pub static C: S = S(f); fn g() { } -type T = &fn(); //~ ERROR missing lifetime specifier +type T = ||; //~ ERROR missing lifetime specifier pub static D: T = g; fn main() {} diff --git a/src/test/compile-fail/issue-5239-1.rs b/src/test/compile-fail/issue-5239-1.rs index 97317ec762a..a316e3df042 100644 --- a/src/test/compile-fail/issue-5239-1.rs +++ b/src/test/compile-fail/issue-5239-1.rs @@ -11,5 +11,5 @@ // Regression test for issue #5239 fn main() { - let x: &fn(int) -> int = |ref x| { x += 1; }; //~ ERROR binary operation + cannot be applied to type `&int` + let x: |int| -> int = |ref x| { x += 1; }; //~ ERROR binary operation + cannot be applied to type `&int` } diff --git a/src/test/compile-fail/issue-6762.rs b/src/test/compile-fail/issue-6762.rs index 14dcc4ea8a3..22bb660a080 100644 --- a/src/test/compile-fail/issue-6762.rs +++ b/src/test/compile-fail/issue-6762.rs @@ -4,20 +4,17 @@ // transferring ownership of the owned box before invoking the stack // closure results in a crash. -fn twice(x: ~uint) -> uint -{ +fn twice(x: ~uint) -> uint { *x * 2 } -fn invoke(f : &fn() -> uint) -{ +fn invoke(f: || -> uint) { f(); } -fn main() -{ +fn main() { let x : ~uint = ~9; - let sq : &fn() -> uint = || { *x * *x }; + let sq : || -> uint = || { *x * *x }; twice(x); invoke(sq); diff --git a/src/test/compile-fail/issue-7573.rs b/src/test/compile-fail/issue-7573.rs index 9dc29e59f90..4ab0ac6386e 100644 --- a/src/test/compile-fail/issue-7573.rs +++ b/src/test/compile-fail/issue-7573.rs @@ -35,7 +35,7 @@ pub fn remove_package_from_database() { } -pub fn list_database(f: &fn(&PkgId)) { +pub fn list_database(f: |&PkgId|) { let stuff = ["foo", "bar"]; for l in stuff.iter() { diff --git a/src/test/compile-fail/kindck-freeze.rs b/src/test/compile-fail/kindck-freeze.rs index c83892e2a3b..474c1b1d3cf 100644 --- a/src/test/compile-fail/kindck-freeze.rs +++ b/src/test/compile-fail/kindck-freeze.rs @@ -45,7 +45,7 @@ fn test<'a,T,U:Freeze>(_: &'a int) { assert_freeze::<&'a mut Dummy:Freeze>(); //~ ERROR does not fulfill `Freeze` // closures are like an `&mut` object - assert_freeze::<&fn()>(); //~ ERROR does not fulfill `Freeze` + assert_freeze::<||>(); //~ ERROR does not fulfill `Freeze` // unsafe ptrs are ok unless they point at unfreezeable things assert_freeze::<*int>(); diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs index 3abacdba183..d73f0e6ab1e 100644 --- a/src/test/compile-fail/lint-unused-mut-variables.rs +++ b/src/test/compile-fail/lint-unused-mut-variables.rs @@ -55,7 +55,7 @@ fn what(mut foo: int) {} //~ ERROR: variable does not need to be mutable let mut _allowed = 1; } -fn callback(f: &fn()) {} +fn callback(f: ||) {} // make sure the lint attribute can be turned off #[allow(unused_mut)] diff --git a/src/test/compile-fail/lint-unused-unsafe.rs b/src/test/compile-fail/lint-unused-unsafe.rs index 50cc9ceb94e..253459be85a 100644 --- a/src/test/compile-fail/lint-unused-unsafe.rs +++ b/src/test/compile-fail/lint-unused-unsafe.rs @@ -18,7 +18,7 @@ mod foo { } } -fn callback(_f: &fn() -> T) -> T { fail!() } +fn callback(_f: || -> T) -> T { fail!() } unsafe fn unsf() {} fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block diff --git a/src/test/compile-fail/liveness-block-unint.rs b/src/test/compile-fail/liveness-block-unint.rs index 98b6cabb6ff..c46b9013a06 100644 --- a/src/test/compile-fail/liveness-block-unint.rs +++ b/src/test/compile-fail/liveness-block-unint.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn force(f: &fn()) { f(); } +fn force(f: ||) { f(); } fn main() { let x: int; force(|| { diff --git a/src/test/compile-fail/liveness-closure-require-ret.rs b/src/test/compile-fail/liveness-closure-require-ret.rs index 8f9941e6688..9d46202d64e 100644 --- a/src/test/compile-fail/liveness-closure-require-ret.rs +++ b/src/test/compile-fail/liveness-closure-require-ret.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn force(f: &fn() -> int) -> int { f() } +fn force(f: || -> int) -> int { f() } fn main() { info!("{:?}", force(|| {})); } //~ ERROR mismatched types diff --git a/src/test/compile-fail/liveness-init-in-called-fn-expr.rs b/src/test/compile-fail/liveness-init-in-called-fn-expr.rs index 7054cb0d901..d759a5738bd 100644 --- a/src/test/compile-fail/liveness-init-in-called-fn-expr.rs +++ b/src/test/compile-fail/liveness-init-in-called-fn-expr.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let j: &fn() -> int = || { + let j: || -> int = || { let i: int; i //~ ERROR use of possibly uninitialized variable: `i` }; diff --git a/src/test/compile-fail/liveness-init-in-fn-expr.rs b/src/test/compile-fail/liveness-init-in-fn-expr.rs index 13816313884..f6bb2f54283 100644 --- a/src/test/compile-fail/liveness-init-in-fn-expr.rs +++ b/src/test/compile-fail/liveness-init-in-fn-expr.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let f: &fn() -> int = || { + let f: || -> int = || { let i: int; i //~ ERROR use of possibly uninitialized variable: `i` }; diff --git a/src/test/compile-fail/missing-do.rs b/src/test/compile-fail/missing-do.rs index e6a7698d0f0..5448766c30a 100644 --- a/src/test/compile-fail/missing-do.rs +++ b/src/test/compile-fail/missing-do.rs @@ -10,7 +10,7 @@ // Regression test for issue #2783 -fn foo(f: &fn()) { f() } +fn foo(f: ||) { f() } fn main() { ~"" || 42; //~ ERROR binary operation || cannot be applied to type diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/compile-fail/moves-based-on-type-block-bad.rs index 11c4d078208..355305b6c63 100644 --- a/src/test/compile-fail/moves-based-on-type-block-bad.rs +++ b/src/test/compile-fail/moves-based-on-type-block-bad.rs @@ -8,7 +8,7 @@ enum E { Baz } -fn f(s: &S, g: &fn(&S)) { +fn f(s: &S, g: |&S|) { g(s) } diff --git a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs index 2762140be37..db8effb1de3 100644 --- a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs @@ -36,7 +36,7 @@ fn innocent_looking_victim() { } } -fn conspirator(f: &fn(&R, bool)) { +fn conspirator(f: |&R, bool|) { let r = R {c: f}; f(&r, false) //~ ERROR use of moved value } diff --git a/src/test/compile-fail/omitted-arg-wrong-types.rs b/src/test/compile-fail/omitted-arg-wrong-types.rs index a44c113269b..f43ff0421a9 100644 --- a/src/test/compile-fail/omitted-arg-wrong-types.rs +++ b/src/test/compile-fail/omitted-arg-wrong-types.rs @@ -9,7 +9,7 @@ // except according to those terms. // xfail-test - #2093 -fn let_in(x: T, f: &fn(T)) {} +fn let_in(x: T, f: |T|) {} fn main() { let_in(3u, |i| { assert!(i == 3); }); diff --git a/src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs b/src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs index aedeb92df78..4927acde48d 100644 --- a/src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs +++ b/src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs @@ -15,7 +15,7 @@ use extra::arc; use std::util; -fn foo(blk: &fn()) { +fn foo(blk: ||) { blk(); blk(); } diff --git a/src/test/compile-fail/once-fn-subtyping.rs b/src/test/compile-fail/once-fn-subtyping.rs index 5f7393fdf8b..503b4d3e77b 100644 --- a/src/test/compile-fail/once-fn-subtyping.rs +++ b/src/test/compile-fail/once-fn-subtyping.rs @@ -11,7 +11,7 @@ #[feature(once_fns)]; fn main() { let f: &once fn() = ||(); - let g: &fn() = f; //~ ERROR mismatched types - let h: &fn() = ||(); + let g: || = f; //~ ERROR mismatched types + let h: || = ||(); let i: &once fn() = h; // ok } diff --git a/src/test/compile-fail/qquote-1.rs b/src/test/compile-fail/qquote-1.rs index 0112c0adea2..f55fcfc204b 100644 --- a/src/test/compile-fail/qquote-1.rs +++ b/src/test/compile-fail/qquote-1.rs @@ -62,6 +62,6 @@ fn main() { check_pp(expr3, pprust::print_expr, "2 - 23 + 7"); } -fn check_pp(expr: T, f: &fn(pprust::ps, T), expect: str) { +fn check_pp(expr: T, f: |pprust::ps, T|, expect: str) { fail!(); } diff --git a/src/test/compile-fail/qquote-2.rs b/src/test/compile-fail/qquote-2.rs index 57355885e2f..262abc045a4 100644 --- a/src/test/compile-fail/qquote-2.rs +++ b/src/test/compile-fail/qquote-2.rs @@ -57,6 +57,6 @@ fn main() { check_pp(*stmt, pprust::print_stmt, ""); } -fn check_pp(expr: T, f: &fn(pprust::ps, T), expect: str) { +fn check_pp(expr: T, f: |pprust::ps, T|, expect: str) { fail!(); } diff --git a/src/test/compile-fail/regionck-closure-lifetimes.rs b/src/test/compile-fail/regionck-closure-lifetimes.rs index c9a3e044d9c..f66b17d68c7 100644 --- a/src/test/compile-fail/regionck-closure-lifetimes.rs +++ b/src/test/compile-fail/regionck-closure-lifetimes.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn env<'a>(_: &'a uint, blk: &fn(p: &'a fn())) { +fn env<'a>(_: &'a uint, blk: |p: 'a |||) { // Test that the closure here cannot be assigned // the lifetime `'a`, which outlives the current // block. @@ -21,7 +21,7 @@ fn env<'a>(_: &'a uint, blk: &fn(p: &'a fn())) { blk(|| *statep = 1); //~ ERROR cannot infer an appropriate lifetime } -fn no_env_no_for<'a>(_: &'a uint, blk: &fn(p: &'a fn())) { +fn no_env_no_for<'a>(_: &'a uint, blk: |p: 'a |||) { // Test that a closure with no free variables CAN // outlive the block in which it is created. // diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs index c2d8427d5eb..0a370425c41 100644 --- a/src/test/compile-fail/regions-creating-enums.rs +++ b/src/test/compile-fail/regions-creating-enums.rs @@ -27,7 +27,7 @@ fn compute(x: &ast) -> uint { } } -fn map_nums(x: &ast, f: &fn(uint) -> uint) -> &ast { +fn map_nums(x: &ast, f: |uint| -> uint) -> &ast { match *x { num(x) => { return &num(f(x)); //~ ERROR borrowed value does not live long enough diff --git a/src/test/compile-fail/regions-escape-bound-fn-2.rs b/src/test/compile-fail/regions-escape-bound-fn-2.rs index 305aa685284..d2551ec4fed 100644 --- a/src/test/compile-fail/regions-escape-bound-fn-2.rs +++ b/src/test/compile-fail/regions-escape-bound-fn-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn with_int(f: &fn(x: &int)) { +fn with_int(f: |x: &int|) { let x = 3; f(&x); } diff --git a/src/test/compile-fail/regions-escape-bound-fn.rs b/src/test/compile-fail/regions-escape-bound-fn.rs index 5ac5e334be2..eb72b4b0c53 100644 --- a/src/test/compile-fail/regions-escape-bound-fn.rs +++ b/src/test/compile-fail/regions-escape-bound-fn.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn with_int(f: &fn(x: &int)) { +fn with_int(f: |x: &int|) { let x = 3; f(&x); } diff --git a/src/test/compile-fail/regions-escape-via-trait-or-not.rs b/src/test/compile-fail/regions-escape-via-trait-or-not.rs index 5b6dc1b2f4f..32ec59d9741 100644 --- a/src/test/compile-fail/regions-escape-via-trait-or-not.rs +++ b/src/test/compile-fail/regions-escape-via-trait-or-not.rs @@ -18,7 +18,7 @@ fn get(self) -> int { } } -fn with(f: &fn(x: &int) -> R) -> int { +fn with(f: |x: &int| -> R) -> int { f(&3).get() } diff --git a/src/test/compile-fail/regions-fn-bound.rs b/src/test/compile-fail/regions-fn-bound.rs index add53d3d9b0..09801d37ee9 100644 --- a/src/test/compile-fail/regions-fn-bound.rs +++ b/src/test/compile-fail/regions-fn-bound.rs @@ -11,8 +11,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn of() -> &fn(T) { fail!(); } -fn subtype(x: &fn(T)) { fail!(); } +fn of() -> |T| { fail!(); } +fn subtype(x: |T|) { fail!(); } fn test_fn(_x: &'x T, _y: &'y T, _z: &'z T) { // Here, x, y, and z are free. Other letters @@ -21,14 +21,14 @@ fn test_fn(_x: &'x T, _y: &'y T, _z: &'z T) { // iff T1 <: T2. // should be the default: - subtype::<&'static fn()>(of::<&fn()>()); - subtype::<&fn()>(of::<&'static fn()>()); + subtype::<'static ||>(of::<||>()); + subtype::<||>(of::<'static ||>()); // - subtype::<&'x fn()>(of::<&fn()>()); //~ ERROR mismatched types - subtype::<&'x fn()>(of::<&'y fn()>()); //~ ERROR mismatched types + subtype::<'x ||>(of::<||>()); //~ ERROR mismatched types + subtype::<'x ||>(of::<'y ||>()); //~ ERROR mismatched types - subtype::<&'x fn()>(of::<&'static fn()>()); //~ ERROR mismatched types - subtype::<&'static fn()>(of::<&'x fn()>()); + subtype::<'x ||>(of::<'static ||>()); //~ ERROR mismatched types + subtype::<'static ||>(of::<'x ||>()); } diff --git a/src/test/compile-fail/regions-fn-subtyping.rs b/src/test/compile-fail/regions-fn-subtyping.rs index cad73daa46b..0cbd37a3b9a 100644 --- a/src/test/compile-fail/regions-fn-subtyping.rs +++ b/src/test/compile-fail/regions-fn-subtyping.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn of() -> &fn(T) { fail!(); } -fn subtype(x: &fn(T)) { fail!(); } +fn of() -> |T| { fail!(); } +fn subtype(x: |T|) { fail!(); } fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) { // Here, x, y, and z are free. Other letters @@ -17,29 +17,29 @@ fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) { // subtype::(of::()) will typecheck // iff T1 <: T2. - subtype::<&fn<'a>(&'a T)>( - of::<&fn<'a>(&'a T)>()); + subtype::< <'a>|&'a T|>( + of::< <'a>|&'a T|>()); - subtype::<&fn<'a>(&'a T)>( - of::<&fn<'b>(&'b T)>()); + subtype::< <'a>|&'a T|>( + of::< <'b>|&'b T|>()); - subtype::<&fn<'b>(&'b T)>( - of::<&fn(&'x T)>()); + subtype::< <'b>|&'b T|>( + of::<|&'x T|>()); - subtype::<&fn(&'x T)>( - of::<&fn<'b>(&'b T)>()); //~ ERROR mismatched types + subtype::<|&'x T|>( + of::< <'b>|&'b T|>()); //~ ERROR mismatched types - subtype::<&fn<'a,'b>(&'a T, &'b T)>( - of::<&fn<'a>(&'a T, &'a T)>()); + subtype::< <'a,'b>|&'a T, &'b T|>( + of::< <'a>|&'a T, &'a T|>()); - subtype::<&fn<'a>(&'a T, &'a T)>( - of::<&fn<'a,'b>(&'a T, &'b T)>()); //~ ERROR mismatched types + subtype::< <'a>|&'a T, &'a T|>( + of::< <'a,'b>|&'a T, &'b T|>()); //~ ERROR mismatched types - subtype::<&fn<'a,'b>(&'a T, &'b T)>( - of::<&fn(&'x T, &'y T)>()); + subtype::< <'a,'b>|&'a T, &'b T|>( + of::<|&'x T, &'y T|>()); - subtype::<&fn(&'x T, &'y T)>( - of::<&fn<'a,'b>(&'a T, &'b T)>()); //~ ERROR mismatched types + subtype::<|&'x T, &'y T|>( + of::< <'a,'b>|&'a T, &'b T|>()); //~ ERROR mismatched types } fn main() {} diff --git a/src/test/compile-fail/regions-fns.rs b/src/test/compile-fail/regions-fns.rs index 715261d816a..854584ec535 100644 --- a/src/test/compile-fail/regions-fns.rs +++ b/src/test/compile-fail/regions-fns.rs @@ -12,7 +12,7 @@ // we reported errors in this case: fn not_ok<'b>(a: &uint, b: &'b uint) { - let mut g: &fn(x: &uint) = |x: &'b uint| {}; + let mut g: |x: &uint| = |x: &'b uint| {}; //~^ ERROR mismatched types g(a); } diff --git a/src/test/compile-fail/regions-free-region-ordering-callee.rs b/src/test/compile-fail/regions-free-region-ordering-callee.rs index fb31e477ba2..94c617b2182 100644 --- a/src/test/compile-fail/regions-free-region-ordering-callee.rs +++ b/src/test/compile-fail/regions-free-region-ordering-callee.rs @@ -30,7 +30,7 @@ fn ordering3<'a, 'b>(x: &'a uint, y: &'b uint) -> &'a &'b uint { fail!(); } -fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: &fn(&'a &'b uint)) { +fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: |&'a &'b uint|) { let z: Option<&'a &'b uint> = None; } diff --git a/src/test/compile-fail/regions-free-region-ordering-caller.rs b/src/test/compile-fail/regions-free-region-ordering-caller.rs index 58fa437a6a3..808e850907f 100644 --- a/src/test/compile-fail/regions-free-region-ordering-caller.rs +++ b/src/test/compile-fail/regions-free-region-ordering-caller.rs @@ -26,7 +26,7 @@ fn call3<'a, 'b>(a: &'a uint, b: &'b uint) { } fn call4<'a, 'b>(a: &'a uint, b: &'b uint) { - let z: Option<&fn(&'a &'b uint)> = None; + let z: Option<|&'a &'b uint|> = None; //~^ ERROR pointer has a longer lifetime than the data it references } diff --git a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs index e0764d39291..26b0f2b66c3 100644 --- a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs +++ b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs @@ -12,7 +12,7 @@ fn borrow<'r, T>(x: &'r T) -> &'r T {x} -fn foo(cond: &fn() -> bool, box: &fn() -> @int) { +fn foo(cond: || -> bool, box: || -> @int) { let mut y: ∫ loop { let x = box(); diff --git a/src/test/compile-fail/regions-infer-call-3.rs b/src/test/compile-fail/regions-infer-call-3.rs index 585b56d5a42..8002f8bcc50 100644 --- a/src/test/compile-fail/regions-infer-call-3.rs +++ b/src/test/compile-fail/regions-infer-call-3.rs @@ -10,7 +10,7 @@ fn select<'r>(x: &'r int, y: &'r int) -> &'r int { x } -fn with(f: &fn(x: &int) -> T) -> T { +fn with(f: |x: &int| -> T) -> T { f(&20) } diff --git a/src/test/compile-fail/regions-name-undeclared.rs b/src/test/compile-fail/regions-name-undeclared.rs index abff33e0514..ba3d7bd29f4 100644 --- a/src/test/compile-fail/regions-name-undeclared.rs +++ b/src/test/compile-fail/regions-name-undeclared.rs @@ -43,16 +43,16 @@ fn f(a: &'a int) { } //~ ERROR undeclared lifetime // &'a CAN be declared on functions and used then: fn g<'a>(a: &'a int) { } // OK - fn h(a: &fn<'a>(&'a int)) { } // OK + fn h(a: <'a>|&'a int|) { } // OK } // Test nesting of lifetimes in fn type declarations fn fn_types(a: &'a int, //~ ERROR undeclared lifetime - b: &fn<'a>(a: &'a int, - b: &'b int, //~ ERROR undeclared lifetime - c: &fn<'b>(a: &'a int, - b: &'b int), - d: &'b int), //~ ERROR undeclared lifetime + b: <'a>|a: &'a int, + b: &'b int, //~ ERROR undeclared lifetime + c: <'b>|a: &'a int, + b: &'b int|, + d: &'b int|, //~ ERROR undeclared lifetime c: &'a int) //~ ERROR undeclared lifetime { } diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/compile-fail/regions-nested-fns-2.rs index fe995052c52..8e9a7546541 100644 --- a/src/test/compile-fail/regions-nested-fns-2.rs +++ b/src/test/compile-fail/regions-nested-fns-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn ignore(_f: &fn<'z>(&'z int) -> &'z int) {} +fn ignore(_f: <'z>|&'z int| -> &'z int) {} fn nested() { let y = 3; diff --git a/src/test/compile-fail/regions-nested-fns.rs b/src/test/compile-fail/regions-nested-fns.rs index 244e9cc06a1..11610f422a0 100644 --- a/src/test/compile-fail/regions-nested-fns.rs +++ b/src/test/compile-fail/regions-nested-fns.rs @@ -14,13 +14,13 @@ fn nested<'x>(x: &'x int) { let y = 3; let mut ay = &y; //~ ERROR cannot infer an appropriate lifetime - ignore::<&fn<'z>(&'z int)>(|z| { + ignore::< <'z>|&'z int|>(|z| { ay = x; ay = &y; ay = z; }); - ignore::<&fn<'z>(&'z int) -> &'z int>(|z| { + ignore::< <'z>|&'z int| -> &'z int>(|z| { if false { return x; } //~ ERROR mismatched types //~^ ERROR cannot infer an appropriate lifetime if false { return ay; } diff --git a/src/test/compile-fail/regions-ref-in-fn-arg.rs b/src/test/compile-fail/regions-ref-in-fn-arg.rs index 48482627507..9574f05fa58 100644 --- a/src/test/compile-fail/regions-ref-in-fn-arg.rs +++ b/src/test/compile-fail/regions-ref-in-fn-arg.rs @@ -2,7 +2,7 @@ fn arg_item(~ref x: ~int) -> &'static int { x //~^ ERROR borrowed value does not live long enough } -fn with(f: &fn(~int) -> R) -> R { f(~3) } +fn with(f: |~int| -> R) -> R { f(~3) } fn arg_closure() -> &'static int { with(|~ref x| x) //~ ERROR borrowed value does not live long enough diff --git a/src/test/compile-fail/regions-ret-borrowed-1.rs b/src/test/compile-fail/regions-ret-borrowed-1.rs index ee6ed3b0d76..7eb5fa3c60b 100644 --- a/src/test/compile-fail/regions-ret-borrowed-1.rs +++ b/src/test/compile-fail/regions-ret-borrowed-1.rs @@ -12,7 +12,7 @@ // some point regions-ret-borrowed reported an error but this file did // not, due to special hardcoding around the anonymous region. -fn with(f: &fn<'a>(x: &'a int) -> R) -> R { +fn with(f: <'a>|x: &'a int| -> R) -> R { f(&3) } diff --git a/src/test/compile-fail/regions-ret-borrowed.rs b/src/test/compile-fail/regions-ret-borrowed.rs index c2e48053260..2f6f2f44cda 100644 --- a/src/test/compile-fail/regions-ret-borrowed.rs +++ b/src/test/compile-fail/regions-ret-borrowed.rs @@ -15,7 +15,7 @@ // used to successfully compile because we failed to account for the // fact that fn(x: &int) rebound the region &. -fn with(f: &fn(x: &int) -> R) -> R { +fn with(f: |x: &int| -> R) -> R { f(&3) } diff --git a/src/test/compile-fail/type-arg-out-of-scope.rs b/src/test/compile-fail/type-arg-out-of-scope.rs index 07dc677c047..240b1aa06d4 100644 --- a/src/test/compile-fail/type-arg-out-of-scope.rs +++ b/src/test/compile-fail/type-arg-out-of-scope.rs @@ -10,6 +10,6 @@ // error-pattern:attempt to use a type argument out of scope fn foo(x: T) { - fn bar(f: &fn(T) -> T) { } + fn bar(f: |T| -> T) { } } fn main() { foo(1); } diff --git a/src/test/debug-info/lexical-scope-in-stack-closure.rs b/src/test/debug-info/lexical-scope-in-stack-closure.rs index 238ad3c519d..f052448c146 100644 --- a/src/test/debug-info/lexical-scope-in-stack-closure.rs +++ b/src/test/debug-info/lexical-scope-in-stack-closure.rs @@ -51,7 +51,7 @@ fn main() { zzz(); sentinel(); - let stack_closure: &fn(int) = |x| { + let stack_closure: |int| = |x| { zzz(); sentinel(); diff --git a/src/test/run-fail/unwind-iter.rs b/src/test/run-fail/unwind-iter.rs index 51c6cb3adf3..1f5e455564e 100644 --- a/src/test/run-fail/unwind-iter.rs +++ b/src/test/run-fail/unwind-iter.rs @@ -13,7 +13,7 @@ #[allow(unreachable_code)]; #[allow(unused_variable)]; -fn x(it: &fn(int)) { +fn x(it: |int|) { fail!(); it(0); } diff --git a/src/test/run-fail/unwind-iter2.rs b/src/test/run-fail/unwind-iter2.rs index 17936df6959..d0726d2544c 100644 --- a/src/test/run-fail/unwind-iter2.rs +++ b/src/test/run-fail/unwind-iter2.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn x(it: &fn(int)) { +fn x(it: |int|) { let _a = @0; it(1); } diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs index 4b95afc0ee2..bd415e9eac3 100644 --- a/src/test/run-fail/unwind-lambda.rs +++ b/src/test/run-fail/unwind-lambda.rs @@ -16,13 +16,13 @@ fn main() { let cheese = ~"roquefort"; let carrots = @~"crunchy"; - let result: &'static fn(@~str, &fn(~str)) = (|tasties, macerate| { + let result: &'static fn(@~str, |~str|) = (|tasties, macerate| { macerate((*tasties).clone()); }); result(carrots, |food| { let mush = food + cheese; let cheese = cheese.clone(); - let f: &fn() = || { + let f: || = || { let _chew = mush + cheese; fail!("so yummy") }; diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index c7c8e3a19a6..0fcd49790e0 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -74,7 +74,7 @@ fn main() { } fn check_pp(cx: fake_ext_ctxt, - expr: T, f: &fn(pprust::ps, T), expect: ~str) { + expr: T, f: |pprust::ps, T|, expect: ~str) { let s = do io::with_str_writer |wr| { let pp = pprust::rust_printer(wr, cx.parse_sess().interner); f(pp, expr); diff --git a/src/test/run-pass/argument-passing.rs b/src/test/run-pass/argument-passing.rs index 6d6ae3da62f..7f43642463e 100644 --- a/src/test/run-pass/argument-passing.rs +++ b/src/test/run-pass/argument-passing.rs @@ -21,7 +21,7 @@ fn f1(a: &mut X, b: &mut int, c: int) -> int { return r; } -fn f2(a: int, f: &fn(int)) -> int { f(1); return a; } +fn f2(a: int, f: |int|) -> int { f(1); return a; } pub fn main() { let mut a = X {x: 1}; diff --git a/src/test/run-pass/assignability-trait.rs b/src/test/run-pass/assignability-trait.rs index 5269f7dab5a..1da5023dce0 100644 --- a/src/test/run-pass/assignability-trait.rs +++ b/src/test/run-pass/assignability-trait.rs @@ -13,17 +13,17 @@ // it. trait iterable { - fn iterate(&self, blk: &fn(x: &A) -> bool) -> bool; + fn iterate(&self, blk: |x: &A| -> bool) -> bool; } impl<'self,A> iterable for &'self [A] { - fn iterate(&self, f: &fn(x: &A) -> bool) -> bool { + fn iterate(&self, f: |x: &A| -> bool) -> bool { self.iter().advance(f) } } impl iterable for ~[A] { - fn iterate(&self, f: &fn(x: &A) -> bool) -> bool { + fn iterate(&self, f: |x: &A| -> bool) -> bool { self.iter().advance(f) } } diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index 440ad723a12..c0ceb50a2c4 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -10,10 +10,10 @@ fn f(x: ~[T]) -> T { return x[0]; } -fn g(act: &fn(~[int]) -> int) -> int { return act(~[1, 2, 3]); } +fn g(act: |~[int]| -> int) -> int { return act(~[1, 2, 3]); } pub fn main() { assert_eq!(g(f), 1); - let f1: &fn(~[~str]) -> ~str = f; + let f1: |~[~str]| -> ~str = f; assert_eq!(f1(~[~"x", ~"y", ~"z"]), ~"x"); } diff --git a/src/test/run-pass/block-arg-call-as.rs b/src/test/run-pass/block-arg-call-as.rs index 5aa28258792..70307e1ff04 100644 --- a/src/test/run-pass/block-arg-call-as.rs +++ b/src/test/run-pass/block-arg-call-as.rs @@ -10,11 +10,11 @@ extern mod extra; -fn asSendfn( f : proc()->uint ) -> uint { +fn asSendfn(f: proc() -> uint) -> uint { return f(); } -fn asBlock( f : &fn()->uint ) -> uint { +fn asBlock(f: || -> uint) -> uint { return f(); } diff --git a/src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs b/src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs index ed8641eaf85..0d82e294caf 100644 --- a/src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs +++ b/src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - fn f(i: &fn() -> uint) -> uint { i() } + fn f(i: || -> uint) -> uint { i() } let v = ~[-1.0, 0.0, 1.0, 2.0, 3.0]; let z = do do v.iter().fold(f) |x, _y| { x } { 22u }; assert_eq!(z, 22u); diff --git a/src/test/run-pass/block-arg-used-as-any.rs b/src/test/run-pass/block-arg-used-as-any.rs index 7ee9d9e5b54..f05eb8e30b1 100644 --- a/src/test/run-pass/block-arg-used-as-any.rs +++ b/src/test/run-pass/block-arg-used-as-any.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn call_any(f: &fn() -> uint) -> uint { +fn call_any(f: || -> uint) -> uint { return f(); } diff --git a/src/test/run-pass/block-explicit-types.rs b/src/test/run-pass/block-explicit-types.rs index 379fced1d33..82e563ae41c 100644 --- a/src/test/run-pass/block-explicit-types.rs +++ b/src/test/run-pass/block-explicit-types.rs @@ -9,6 +9,6 @@ // except according to those terms. pub fn main() { - fn as_buf(s: ~str, f: &fn(~str) -> T) -> T { f(s) } + fn as_buf(s: ~str, f: |~str| -> T) -> T { f(s) } as_buf(~"foo", |foo: ~str| -> () error!("{}", foo) ); } diff --git a/src/test/run-pass/block-fn-coerce.rs b/src/test/run-pass/block-fn-coerce.rs index 19e1fd4099b..bbb30e9578e 100644 --- a/src/test/run-pass/block-fn-coerce.rs +++ b/src/test/run-pass/block-fn-coerce.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn force(f: &fn() -> int) -> int { return f(); } +fn force(f: || -> int) -> int { return f(); } pub fn main() { fn f() -> int { return 7; } assert_eq!(force(f), 7); diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs index a977eb40992..821f4b17a79 100644 --- a/src/test/run-pass/block-iter-1.rs +++ b/src/test/run-pass/block-iter-1.rs @@ -10,7 +10,7 @@ // xfail-fast -fn iter_vec(v: ~[T], f: &fn(&T)) { for x in v.iter() { f(x); } } +fn iter_vec(v: ~[T], f: |&T|) { for x in v.iter() { f(x); } } pub fn main() { let v = ~[1, 2, 3, 4, 5, 6, 7]; diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index e5ea54c2a3e..ddaf7f233cf 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -10,7 +10,7 @@ // xfail-fast -fn iter_vec(v: ~[T], f: &fn(&T)) { for x in v.iter() { f(x); } } +fn iter_vec(v: ~[T], f: |&T|) { for x in v.iter() { f(x); } } pub fn main() { let v = ~[1, 2, 3, 4, 5]; diff --git a/src/test/run-pass/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck-borrow-from-expr-block.rs index bc3078f88ea..dae10ed6d39 100644 --- a/src/test/run-pass/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck-borrow-from-expr-block.rs @@ -13,7 +13,7 @@ use std::borrow; use std::ptr; -fn borrow(x: &int, f: &fn(x: &int)) { +fn borrow(x: &int, f: |x: &int|) { f(x) } diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs index 9057ebf7983..7b4c4247a35 100644 --- a/src/test/run-pass/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck-mut-uniq.rs @@ -20,7 +20,7 @@ fn add_int(x: &mut Ints, v: int) { util::swap(&mut values, &mut x.values); } -fn iter_ints(x: &Ints, f: &fn(x: &int) -> bool) -> bool { +fn iter_ints(x: &Ints, f: |x: &int| -> bool) -> bool { let l = x.values.len(); range(0u, l).advance(|i| f(&x.values[i])) } diff --git a/src/test/run-pass/borrowck-preserve-box-in-field.rs b/src/test/run-pass/borrowck-preserve-box-in-field.rs index 214753c009c..bc8eeb5cd41 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-field.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-field.rs @@ -12,7 +12,7 @@ use std::ptr; -fn borrow(x: &int, f: &fn(x: &int)) { +fn borrow(x: &int, f: |x: &int|) { let before = *x; f(x); let after = *x; diff --git a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs index 239dd4c6dc4..3ff30192efe 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs @@ -12,7 +12,7 @@ use std::ptr; -fn borrow(x: &int, f: &fn(x: &int)) { +fn borrow(x: &int, f: |x: &int|) { let before = *x; f(x); let after = *x; diff --git a/src/test/run-pass/borrowck-preserve-box.rs b/src/test/run-pass/borrowck-preserve-box.rs index 8a97e8f1b5c..e83621d6bb2 100644 --- a/src/test/run-pass/borrowck-preserve-box.rs +++ b/src/test/run-pass/borrowck-preserve-box.rs @@ -12,7 +12,7 @@ use std::ptr; -fn borrow(x: &int, f: &fn(x: &int)) { +fn borrow(x: &int, f: |x: &int|) { let before = *x; f(x); let after = *x; diff --git a/src/test/run-pass/borrowck-preserve-expl-deref.rs b/src/test/run-pass/borrowck-preserve-expl-deref.rs index a0010d36190..6041fa977f5 100644 --- a/src/test/run-pass/borrowck-preserve-expl-deref.rs +++ b/src/test/run-pass/borrowck-preserve-expl-deref.rs @@ -12,7 +12,7 @@ use std::ptr; -fn borrow(x: &int, f: &fn(x: &int)) { +fn borrow(x: &int, f: |x: &int|) { let before = *x; f(x); let after = *x; diff --git a/src/test/run-pass/closure-inference.rs b/src/test/run-pass/closure-inference.rs index 167fbdf3fc0..b6943b45700 100644 --- a/src/test/run-pass/closure-inference.rs +++ b/src/test/run-pass/closure-inference.rs @@ -12,7 +12,7 @@ fn foo(i: int) -> int { i + 1 } -fn apply(f: &fn(A) -> A, v: A) -> A { f(v) } +fn apply(f: |A| -> A, v: A) -> A { f(v) } pub fn main() { let f = {|i| foo(i)}; diff --git a/src/test/run-pass/do-empty-args.rs b/src/test/run-pass/do-empty-args.rs index 485d59da7d4..0078294eb89 100644 --- a/src/test/run-pass/do-empty-args.rs +++ b/src/test/run-pass/do-empty-args.rs @@ -11,7 +11,7 @@ // no-reformat // Testing various forms of `do` with empty arg lists -fn f(_f: &fn() -> bool) -> bool { +fn f(_f: || -> bool) -> bool { true } diff --git a/src/test/run-pass/do-no-args.rs b/src/test/run-pass/do-no-args.rs index 1f725ffb357..eb6a4a3db54 100644 --- a/src/test/run-pass/do-no-args.rs +++ b/src/test/run-pass/do-no-args.rs @@ -10,9 +10,9 @@ // Testing that we can drop the || in do exprs -fn f(_f: &fn() -> bool) -> bool { true } +fn f(_f: || -> bool) -> bool { true } -fn d(_f: &fn()) { } +fn d(_f: ||) { } pub fn main() { do d { } diff --git a/src/test/run-pass/do-pure.rs b/src/test/run-pass/do-pure.rs index 8a0509c1774..85bb84c6061 100644 --- a/src/test/run-pass/do-pure.rs +++ b/src/test/run-pass/do-pure.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(_f: &fn()) { +fn f(_f: ||) { } fn g() { diff --git a/src/test/run-pass/do-stack.rs b/src/test/run-pass/do-stack.rs index 0444b269cb3..fddf3b15c78 100644 --- a/src/test/run-pass/do-stack.rs +++ b/src/test/run-pass/do-stack.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(f: &fn(int)) { f(10) } +fn f(f: |int|) { f(10) } pub fn main() { do f() |i| { assert!(i == 10) } diff --git a/src/test/run-pass/do1.rs b/src/test/run-pass/do1.rs index 0444b269cb3..fddf3b15c78 100644 --- a/src/test/run-pass/do1.rs +++ b/src/test/run-pass/do1.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(f: &fn(int)) { f(10) } +fn f(f: |int|) { f(10) } pub fn main() { do f() |i| { assert!(i == 10) } diff --git a/src/test/run-pass/do2.rs b/src/test/run-pass/do2.rs index 9feededc980..1bfb10a9f75 100644 --- a/src/test/run-pass/do2.rs +++ b/src/test/run-pass/do2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(f: &fn(int) -> int) -> int { f(10) } +fn f(f: |int| -> int) -> int { f(10) } pub fn main() { assert_eq!(do f() |i| { i }, 10); diff --git a/src/test/run-pass/do3.rs b/src/test/run-pass/do3.rs index eeb983b4557..c08842a45ce 100644 --- a/src/test/run-pass/do3.rs +++ b/src/test/run-pass/do3.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(f: &fn(int) -> int) -> int { f(10) } +fn f(f: |int| -> int) -> int { f(10) } pub fn main() { assert_eq!(do f |i| { i }, 10); diff --git a/src/test/run-pass/fn-bare-coerce-to-block.rs b/src/test/run-pass/fn-bare-coerce-to-block.rs index db7604d1148..1231a49dcd3 100644 --- a/src/test/run-pass/fn-bare-coerce-to-block.rs +++ b/src/test/run-pass/fn-bare-coerce-to-block.rs @@ -10,7 +10,7 @@ fn bare() {} -fn likes_block(f: &fn()) { f() } +fn likes_block(f: ||) { f() } pub fn main() { likes_block(bare); diff --git a/src/test/run-pass/fn-pattern-expected-type.rs b/src/test/run-pass/fn-pattern-expected-type.rs index 450e2a70aab..fb75abc6ea0 100644 --- a/src/test/run-pass/fn-pattern-expected-type.rs +++ b/src/test/run-pass/fn-pattern-expected-type.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let f: &fn((int,int)) = |(x, y)| { + let f: |(int,int)| = |(x, y)| { assert_eq!(x, 1); assert_eq!(y, 2); }; diff --git a/src/test/run-pass/fn-type-infer.rs b/src/test/run-pass/fn-type-infer.rs index 09e7ababa6c..cf783ca141c 100644 --- a/src/test/run-pass/fn-type-infer.rs +++ b/src/test/run-pass/fn-type-infer.rs @@ -11,7 +11,7 @@ #[allow(unused_variable)]; pub fn main() { - // We should be able to type infer inside of &fns. + // We should be able to type infer inside of ||s. let _f = || { let i = 10; }; diff --git a/src/test/run-pass/foreach-nested.rs b/src/test/run-pass/foreach-nested.rs index 36c086093cf..1f63bd68d34 100644 --- a/src/test/run-pass/foreach-nested.rs +++ b/src/test/run-pass/foreach-nested.rs @@ -11,7 +11,7 @@ -fn two(it: &fn(int)) { it(0); it(1); } +fn two(it: |int|) { it(0); it(1); } pub fn main() { let mut a: ~[int] = ~[-1, -1, -1, -1]; diff --git a/src/test/run-pass/foreach-put-structured.rs b/src/test/run-pass/foreach-put-structured.rs index 2b57cc033f9..91468841e09 100644 --- a/src/test/run-pass/foreach-put-structured.rs +++ b/src/test/run-pass/foreach-put-structured.rs @@ -10,7 +10,7 @@ -fn pairs(it: &fn((int, int))) { +fn pairs(it: |(int, int)|) { let mut i: int = 0; let mut j: int = 0; while i < 10 { it((i, j)); i += 1; j += i; } diff --git a/src/test/run-pass/foreach-simple-outer-slot.rs b/src/test/run-pass/foreach-simple-outer-slot.rs index f38ac1ed38b..34b13189326 100644 --- a/src/test/run-pass/foreach-simple-outer-slot.rs +++ b/src/test/run-pass/foreach-simple-outer-slot.rs @@ -19,7 +19,7 @@ pub fn main() { assert_eq!(sum, 45); } -fn first_ten(it: &fn(int)) { +fn first_ten(it: |int|) { let mut i: int = 0; while i < 10 { info!("first_ten"); it(i); i = i + 1; } } diff --git a/src/test/run-pass/fun-call-variants.rs b/src/test/run-pass/fun-call-variants.rs index 0edfe174680..479f4f8387f 100644 --- a/src/test/run-pass/fun-call-variants.rs +++ b/src/test/run-pass/fun-call-variants.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn ho(f: &fn(int) -> int) -> int { let n: int = f(3); return n; } +fn ho(f: |int| -> int) -> int { let n: int = f(3); return n; } fn direct(x: int) -> int { return x + 1; } diff --git a/src/test/run-pass/generic-static-methods.rs b/src/test/run-pass/generic-static-methods.rs index 2e281812d13..5832c565d7f 100644 --- a/src/test/run-pass/generic-static-methods.rs +++ b/src/test/run-pass/generic-static-methods.rs @@ -9,11 +9,11 @@ // except according to those terms. trait vec_utils { - fn map_(x: &Self, f: &fn(&T) -> U) -> ~[U]; + fn map_(x: &Self, f: |&T| -> U) -> ~[U]; } impl vec_utils for ~[T] { - fn map_(x: &~[T], f: &fn(&T) -> U) -> ~[U] { + fn map_(x: &~[T], f: |&T| -> U) -> ~[U] { let mut r = ~[]; for elt in x.iter() { r.push(f(elt)); diff --git a/src/test/run-pass/issue-1458.rs b/src/test/run-pass/issue-1458.rs index e22f38287ad..ce5c932f8da 100644 --- a/src/test/run-pass/issue-1458.rs +++ b/src/test/run-pass/issue-1458.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn plus_one(f: &fn() -> int) -> int { +fn plus_one(f: || -> int) -> int { return f() + 1; } -fn ret_plus_one() -> extern fn(&fn() -> int) -> int { +fn ret_plus_one() -> extern fn(|| -> int) -> int { return plus_one; } diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index fdf88f414ec..afe7656b7a3 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -18,12 +18,12 @@ // // Running /usr/local/bin/rustc: // issue-2185.rs:24:0: 26:1 error: conflicting implementations for a trait -// issue-2185.rs:24 impl iterable for &'static fn(&fn(uint)) { -// issue-2185.rs:25 fn iter(&self, blk: &fn(v: uint)) { self( |i| blk(i) ) } +// issue-2185.rs:24 impl iterable for &'static fn(|uint|) { +// issue-2185.rs:25 fn iter(&self, blk: |v: uint|) { self( |i| blk(i) ) } // issue-2185.rs:26 } // issue-2185.rs:20:0: 22:1 note: note conflicting implementation here -// issue-2185.rs:20 impl iterable for &'static fn(&fn(A)) { -// issue-2185.rs:21 fn iter(&self, blk: &fn(A)) { self(blk); } +// issue-2185.rs:20 impl iterable for 'static ||A|| { +// issue-2185.rs:21 fn iter(&self, blk: |A|) { self(blk); } // issue-2185.rs:22 } // // … so it looks like it's just not possible to implement both the generic iterable and iterable for the type iterable. Is it okay if I just remove this test? @@ -39,26 +39,24 @@ // warrant still having a test, so I inlined the old definitions. trait iterable { - fn iter(&self, blk: &fn(A)); + fn iter(&self, blk: |A|); } -impl iterable for &'static fn(&fn(A)) { - fn iter(&self, blk: &fn(A)) { self(blk); } +impl iterable for 'static ||A|| { + fn iter(&self, blk: |A|) { self(blk); } } -impl iterable for &'static fn(&fn(uint)) { - fn iter(&self, blk: &fn(v: uint)) { self( |i| blk(i) ) } +impl iterable for 'static ||uint|| { + fn iter(&self, blk: |v: uint|) { self( |i| blk(i) ) } } -fn filter>(self: IA, - prd: &'static fn(A) -> bool, - blk: &fn(A)) { +fn filter>(self: IA, prd: 'static |A| -> bool, blk: |A|) { do self.iter |a| { if prd(a) { blk(a) } } } -fn foldl>(self: IA, b0: B, blk: &fn(B, A) -> B) -> B { +fn foldl>(self: IA, b0: B, blk: |B, A| -> B) -> B { let mut b = b0; do self.iter |a| { b = blk(b, a); @@ -66,7 +64,7 @@ fn foldl>(self: IA, b0: B, blk: &fn(B, A) -> B) -> B { b } -fn range(lo: uint, hi: uint, it: &fn(uint)) { +fn range(lo: uint, hi: uint, it: |uint|) { let mut i = lo; while i < hi { it(i); @@ -75,8 +73,8 @@ fn range(lo: uint, hi: uint, it: &fn(uint)) { } pub fn main() { - let range: &'static fn(&fn(uint)) = |a| range(0u, 1000u, a); - let filt: &'static fn(&fn(v: uint)) = |a| filter( + let range: 'static ||uint|| = |a| range(0u, 1000u, a); + let filt: 'static ||v: uint|| = |a| filter( range, |&&n: uint| n % 3u != 0u && n % 5u != 0u, a); diff --git a/src/test/run-pass/issue-2190-2.rs b/src/test/run-pass/issue-2190-2.rs index d5ee712d412..571944e5300 100644 --- a/src/test/run-pass/issue-2190-2.rs +++ b/src/test/run-pass/issue-2190-2.rs @@ -10,19 +10,19 @@ // xfail-test FIXME #2190 mod a { - fn foo(f: &fn()) { f() } + fn foo(f: ||) { f() } fn bar() {} pub fn main() { foo(||bar()); } } mod b { - fn foo(f: Option<&fn()>) { f.iter(|x|x()) } + fn foo(f: Option<||>) { f.iter(|x|x()) } fn bar() {} pub fn main() { foo(Some(bar)); } } mod c { - fn foo(f: Option<&fn()>) { f.iter(|x|x()) } + fn foo(f: Option<||>) { f.iter(|x|x()) } fn bar() {} pub fn main() { foo(Some(||bar())); } } diff --git a/src/test/run-pass/issue-2487-a.rs b/src/test/run-pass/issue-2487-a.rs index c12325e6ff5..110bceced82 100644 --- a/src/test/run-pass/issue-2487-a.rs +++ b/src/test/run-pass/issue-2487-a.rs @@ -31,7 +31,7 @@ fn socket() -> socket { } } -fn closure(f: &fn()) { f() } +fn closure(f: ||) { f() } fn setsockopt_bytes(_sock: int) { } diff --git a/src/test/run-pass/issue-3429.rs b/src/test/run-pass/issue-3429.rs index fc493485b79..cce90f8a2cd 100644 --- a/src/test/run-pass/issue-3429.rs +++ b/src/test/run-pass/issue-3429.rs @@ -10,6 +10,6 @@ pub fn main() { let x = 1; - let y: &fn() -> int = || x; + let y: || -> int = || x; let _z = y(); } diff --git a/src/test/run-pass/issue-3796.rs b/src/test/run-pass/issue-3796.rs index 5f440939139..a7c6f86b453 100644 --- a/src/test/run-pass/issue-3796.rs +++ b/src/test/run-pass/issue-3796.rs @@ -12,7 +12,7 @@ #[deny(dead_assignment)]; fn main() { let mut x = 1; - let f: &fn() -> int = || { x + 20 }; + let f: || -> int = || { x + 20 }; assert_eq!(f(), 21); x += 1; assert_eq!(f(), 22); diff --git a/src/test/run-pass/issue-3874.rs b/src/test/run-pass/issue-3874.rs index ea1242ae216..40725311f31 100644 --- a/src/test/run-pass/issue-3874.rs +++ b/src/test/run-pass/issue-3874.rs @@ -10,7 +10,7 @@ enum PureCounter { PureCounter(uint) } -fn each(thing: PureCounter, blk: &fn(v: &uint)) { +fn each(thing: PureCounter, blk: |v: &uint|) { let PureCounter(ref x) = thing; blk(x); } diff --git a/src/test/run-pass/issue-3904.rs b/src/test/run-pass/issue-3904.rs index 6b678ffdb1c..4a9b58067b0 100644 --- a/src/test/run-pass/issue-3904.rs +++ b/src/test/run-pass/issue-3904.rs @@ -9,7 +9,7 @@ // except according to those terms. // xfail-test -type ErrPrinter = &fn(&str, &str); +type ErrPrinter = |&str, &str|; fn example_err(prog: &str, arg: &str) { println!("{}: {}", prog, arg) diff --git a/src/test/run-pass/issue-5239-2.rs b/src/test/run-pass/issue-5239-2.rs index ba70fac0e4e..eabc1cfeb59 100644 --- a/src/test/run-pass/issue-5239-2.rs +++ b/src/test/run-pass/issue-5239-2.rs @@ -11,7 +11,7 @@ // Regression test for issue #5239 pub fn main() { - let _f: &fn(int) -> int = |ref x: int| { *x }; + let _f: |int| -> int = |ref x: int| { *x }; let foo = 10; assert!(_f(foo) == 10); } diff --git a/src/test/run-pass/issue-6153.rs b/src/test/run-pass/issue-6153.rs index 668d6f3ae45..f7d0316880a 100644 --- a/src/test/run-pass/issue-6153.rs +++ b/src/test/run-pass/issue-6153.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn swap(f: &fn(~[int]) -> ~[int]) -> ~[int] { +fn swap(f: |~[int]| -> ~[int]) -> ~[int] { let x = ~[1, 2, 3]; f(x) } diff --git a/src/test/run-pass/issue-868.rs b/src/test/run-pass/issue-868.rs index 2a82f559d54..12dcc4ecd2c 100644 --- a/src/test/run-pass/issue-868.rs +++ b/src/test/run-pass/issue-868.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(g: &fn() -> T) -> T { g() } +fn f(g: || -> T) -> T { g() } pub fn main() { let _x = f( | | { 10 }); diff --git a/src/test/run-pass/iter-range.rs b/src/test/run-pass/iter-range.rs index 5ada4aa8c75..c44b7389666 100644 --- a/src/test/run-pass/iter-range.rs +++ b/src/test/run-pass/iter-range.rs @@ -10,7 +10,7 @@ -fn range_(a: int, b: int, it: &fn(int)) { +fn range_(a: int, b: int, it: |int|) { assert!((a < b)); let mut i: int = a; while i < b { it(i); i += 1; } diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index e615cfae6ad..b6ee2d10fb3 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -9,13 +9,13 @@ // except according to those terms. // This should typecheck even though the type of e is not fully -// resolved when we finish typechecking the &fn. +// resolved when we finish typechecking the ||. struct Refs { refs: ~[int], n: int } pub fn main() { let e = @mut Refs{refs: ~[], n: 0}; - let _f: &fn() = || error!("{}", e.n); + let _f: || = || error!("{}", e.n); e.refs.push(1); } diff --git a/src/test/run-pass/last-use-in-block.rs b/src/test/run-pass/last-use-in-block.rs index e2dbf7d29db..8117c5657e9 100644 --- a/src/test/run-pass/last-use-in-block.rs +++ b/src/test/run-pass/last-use-in-block.rs @@ -10,7 +10,7 @@ // Issue #1818 -fn lp(s: ~str, f: &fn(~str) -> T) -> T { +fn lp(s: ~str, f: |~str| -> T) -> T { while false { let r = f(s); return (r); @@ -18,8 +18,8 @@ fn lp(s: ~str, f: &fn(~str) -> T) -> T { fail!(); } -fn apply(s: ~str, f: &fn(~str) -> T) -> T { - fn g(s: ~str, f: &fn(~str) -> T) -> T {f(s)} +fn apply(s: ~str, f: |~str| -> T) -> T { + fn g(s: ~str, f: |~str| -> T) -> T {f(s)} g(s, |v| { let r = f(v); r }) } diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 5c349a09551..c34e65b2b42 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -13,7 +13,7 @@ struct A { a: ~int } pub fn main() { - fn invoke(f: &fn()) { f(); } + fn invoke(f: ||) { f(); } let k = ~22; let _u = A {a: k.clone()}; invoke(|| error!("{:?}", k.clone()) ) diff --git a/src/test/run-pass/match-phi.rs b/src/test/run-pass/match-phi.rs index c25f573e73b..fc851e444e8 100644 --- a/src/test/run-pass/match-phi.rs +++ b/src/test/run-pass/match-phi.rs @@ -13,7 +13,7 @@ enum thing { a, b, c, } -fn foo(it: &fn(int)) { it(10); } +fn foo(it: |int|) { it(10); } pub fn main() { let mut x = true; diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 8baf15c8493..891ee4812c1 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -11,11 +11,11 @@ // xfail-fast trait vec_monad { - fn bind(&self, f: &fn(&A) -> ~[B]) -> ~[B]; + fn bind(&self, f: |&A| -> ~[B]) -> ~[B]; } impl vec_monad for ~[A] { - fn bind(&self, f: &fn(&A) -> ~[B]) -> ~[B] { + fn bind(&self, f: |&A| -> ~[B]) -> ~[B] { let mut r = ~[]; for elt in self.iter() { r.push_all_move(f(elt)); @@ -25,11 +25,11 @@ fn bind(&self, f: &fn(&A) -> ~[B]) -> ~[B] { } trait option_monad { - fn bind(&self, f: &fn(&A) -> Option) -> Option; + fn bind(&self, f: |&A| -> Option) -> Option; } impl option_monad for Option { - fn bind(&self, f: &fn(&A) -> Option) -> Option { + fn bind(&self, f: |&A| -> Option) -> Option { match *self { Some(ref a) => { f(a) } None => { None } diff --git a/src/test/run-pass/move-nullary-fn.rs b/src/test/run-pass/move-nullary-fn.rs index 87281c2fd22..4b613e9beaa 100644 --- a/src/test/run-pass/move-nullary-fn.rs +++ b/src/test/run-pass/move-nullary-fn.rs @@ -9,9 +9,9 @@ // except according to those terms. // Issue #922 -fn f2(_thing: &fn()) { } +fn f2(_thing: ||) { } -fn f(thing: &fn()) { +fn f(thing: ||) { f2(thing); } diff --git a/src/test/run-pass/mut-function-arguments.rs b/src/test/run-pass/mut-function-arguments.rs index 0fa89ba0f04..5801ccebb0f 100644 --- a/src/test/run-pass/mut-function-arguments.rs +++ b/src/test/run-pass/mut-function-arguments.rs @@ -14,7 +14,7 @@ fn f(mut y: ~int) { } fn g() { - let frob: &fn(~int) = |mut q| { *q = 2; assert!(*q == 2); }; + let frob: |~int| = |mut q| { *q = 2; assert!(*q == 2); }; let w = ~37; frob(w); diff --git a/src/test/run-pass/newlambdas.rs b/src/test/run-pass/newlambdas.rs index d9d0daa7138..1835514c0d1 100644 --- a/src/test/run-pass/newlambdas.rs +++ b/src/test/run-pass/newlambdas.rs @@ -10,9 +10,9 @@ // Tests for the new |args| expr lambda syntax -fn f(i: int, f: &fn(int) -> int) -> int { f(i) } +fn f(i: int, f: |int| -> int) -> int { f(i) } -fn g(_g: &fn()) { } +fn g(_g: ||) { } pub fn main() { assert_eq!(f(10, |a| a), 10); diff --git a/src/test/run-pass/non-legacy-modes.rs b/src/test/run-pass/non-legacy-modes.rs index 642686e06e5..8262432db60 100644 --- a/src/test/run-pass/non-legacy-modes.rs +++ b/src/test/run-pass/non-legacy-modes.rs @@ -12,7 +12,7 @@ struct X { repr: int } -fn apply(x: T, f: &fn(T)) { +fn apply(x: T, f: |T|) { f(x); } diff --git a/src/test/run-pass/purity-infer.rs b/src/test/run-pass/purity-infer.rs index debde77b211..bbb312842ce 100644 --- a/src/test/run-pass/purity-infer.rs +++ b/src/test/run-pass/purity-infer.rs @@ -9,7 +9,7 @@ // except according to those terms. -fn something(f: &fn()) { f(); } +fn something(f: ||) { f(); } pub fn main() { something(|| error!("hi!") ); } diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index 42614f76539..96081d30275 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -22,7 +22,7 @@ /// Trait for visitor that wishes to reflect on data. trait movable_ptr { - fn move_ptr(&mut self, adjustment: &fn(*c_void) -> *c_void); + fn move_ptr(&mut self, adjustment: |*c_void| -> *c_void); } /// Helper function for alignment calculation. @@ -471,7 +471,7 @@ struct Stuff { } impl my_visitor { - pub fn get(&mut self, f: &fn(T)) { + pub fn get(&mut self, f: |T|) { unsafe { f((*(self.ptr1 as *T)).clone()); } @@ -490,7 +490,7 @@ pub fn visit_inner(&mut self, inner: *TyDesc) -> bool { struct Inner { inner: V } impl movable_ptr for my_visitor { - fn move_ptr(&mut self, adjustment: &fn(*c_void) -> *c_void) { + fn move_ptr(&mut self, adjustment: |*c_void| -> *c_void) { self.ptr1 = adjustment(self.ptr1); self.ptr2 = adjustment(self.ptr2); } diff --git a/src/test/run-pass/regions-fn-subtyping-2.rs b/src/test/run-pass/regions-fn-subtyping-2.rs index ef8d9970c2b..9d2a959eae1 100644 --- a/src/test/run-pass/regions-fn-subtyping-2.rs +++ b/src/test/run-pass/regions-fn-subtyping-2.rs @@ -13,13 +13,13 @@ // Here, `f` is a function that takes a pointer `x` and a function // `g`, where `g` requires its argument `y` to be in the same region // that `x` is in. -fn has_same_region(f: &fn<'a>(x: &'a int, g: &fn(y: &'a int))) { +fn has_same_region(f: <'a>|x: &'a int, g: |y: &'a int||) { // `f` should be the type that `wants_same_region` wants, but // right now the compiler complains that it isn't. wants_same_region(f); } -fn wants_same_region(_f: &fn<'b>(x: &'b int, g: &fn(y: &'b int))) { +fn wants_same_region(_f: <'b>|x: &'b int, g: |y: &'b int||) { } pub fn main() { diff --git a/src/test/run-pass/regions-fn-subtyping.rs b/src/test/run-pass/regions-fn-subtyping.rs index 06c8aca4741..14e56bd6181 100644 --- a/src/test/run-pass/regions-fn-subtyping.rs +++ b/src/test/run-pass/regions-fn-subtyping.rs @@ -14,21 +14,21 @@ #[allow(unused_variable)]; // Should pass region checking. -fn ok(f: &fn(x: &uint)) { +fn ok(f: |x: &uint|) { // Here, g is a function that can accept a uint pointer with // lifetime r, and f is a function that can accept a uint pointer // with any lifetime. The assignment g = f should be OK (i.e., // f's type should be a subtype of g's type), because f can be // used in any context that expects g's type. But this currently // fails. - let mut g: &fn<'r>(y: &'r uint) = |x| { }; + let mut g: <'r>|y: &'r uint| = |x| { }; g = f; } // This version is the same as above, except that here, g's type is // inferred. -fn ok_inferred(f: &fn(x: &uint)) { - let mut g: &fn<'r>(x: &'r uint) = |_| {}; +fn ok_inferred(f: |x: &uint|) { + let mut g: <'r>|x: &'r uint| = |_| {}; g = f; } diff --git a/src/test/run-pass/regions-infer-call-2.rs b/src/test/run-pass/regions-infer-call-2.rs index 42be3b5b975..061f2797287 100644 --- a/src/test/run-pass/regions-infer-call-2.rs +++ b/src/test/run-pass/regions-infer-call-2.rs @@ -10,7 +10,7 @@ fn takes_two(x: &int, y: &int) -> int { *x + *y } -fn with(f: &fn(x: &int) -> T) -> T { +fn with(f: |x: &int| -> T) -> T { f(&20) } diff --git a/src/test/run-pass/regions-params.rs b/src/test/run-pass/regions-params.rs index ea32cf866a0..5fe92f527d0 100644 --- a/src/test/run-pass/regions-params.rs +++ b/src/test/run-pass/regions-params.rs @@ -12,7 +12,7 @@ fn region_identity<'r>(x: &'r uint) -> &'r uint { x } -fn apply(t: T, f: &fn(T) -> T) -> T { f(t) } +fn apply(t: T, f: |T| -> T) -> T { f(t) } fn parameterized(x: &uint) -> uint { let z = apply(x, ({|y| diff --git a/src/test/run-pass/sendfn-is-a-block.rs b/src/test/run-pass/sendfn-is-a-block.rs index f7808f7f8ac..1b80d7648a6 100644 --- a/src/test/run-pass/sendfn-is-a-block.rs +++ b/src/test/run-pass/sendfn-is-a-block.rs @@ -10,7 +10,7 @@ // xfail-fast -fn test(f: &fn(uint) -> uint) -> uint { +fn test(f: |uint| -> uint) -> uint { return f(22u); } diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 651b3342d58..28aab18cf6c 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -26,12 +26,12 @@ impl plus for ~str { fn plus(&self) -> int { 200 } } trait uint_utils { fn str(&self) -> ~str; - fn multi(&self, f: &fn(uint)); + fn multi(&self, f: |uint|); } impl uint_utils for uint { fn str(&self) -> ~str { self.to_str() } - fn multi(&self, f: &fn(uint)) { + fn multi(&self, f: |uint|) { let mut c = 0u; while c < *self { f(c); c += 1u; } } @@ -39,14 +39,14 @@ fn multi(&self, f: &fn(uint)) { trait vec_utils { fn length_(&self, ) -> uint; - fn iter_(&self, f: &fn(&T)); - fn map_(&self, f: &fn(&T) -> U) -> ~[U]; + fn iter_(&self, f: |&T|); + fn map_(&self, f: |&T| -> U) -> ~[U]; } impl vec_utils for ~[T] { fn length_(&self) -> uint { self.len() } - fn iter_(&self, f: &fn(&T)) { for x in self.iter() { f(x); } } - fn map_(&self, f: &fn(&T) -> U) -> ~[U] { + fn iter_(&self, f: |&T|) { for x in self.iter() { f(x); } } + fn map_(&self, f: |&T| -> U) -> ~[U] { let mut r = ~[]; for elt in self.iter() { r.push(f(elt)); diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index 395d6b0b51a..94e402bfa90 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -45,7 +45,7 @@ fn notify(ch: Chan, v: @mut bool) -> notify { } fn joinable(f: proc()) -> Port { - fn wrapper(c: Chan, f: &fn()) { + fn wrapper(c: Chan, f: ||) { let b = @mut false; error!("wrapper: task=%? allocated v=%x", 0, diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs index a1075345140..cee2079251a 100644 --- a/src/test/run-pass/tempfile.rs +++ b/src/test/run-pass/tempfile.rs @@ -136,7 +136,7 @@ pub fn test_rmdir_recursive_ok() { assert!(!root.join("bar").join("blat").exists()); } -fn in_tmpdir(f: &fn()) { +fn in_tmpdir(f: ||) { let tmpdir = TempDir::new("test").expect("can't make tmpdir"); assert!(os::change_dir(tmpdir.path())); diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index a4510ef70e1..7b331c43568 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -22,7 +22,7 @@ use std::cell; trait Pet { - fn name(&self, blk: &fn(&str)); + fn name(&self, blk: |&str|); fn num_legs(&self) -> uint; fn of_good_pedigree(&self) -> bool; } @@ -44,19 +44,19 @@ struct Goldfyshe { } impl Pet for Catte { - fn name(&self, blk: &fn(&str)) { blk(self.name) } + fn name(&self, blk: |&str|) { blk(self.name) } fn num_legs(&self) -> uint { 4 } fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 } } impl Pet for Dogge { - fn name(&self, blk: &fn(&str)) { blk(self.name) } + fn name(&self, blk: |&str|) { blk(self.name) } fn num_legs(&self) -> uint { 4 } fn of_good_pedigree(&self) -> bool { self.bark_decibels < 70 || self.tricks_known > 20 } } impl Pet for Goldfyshe { - fn name(&self, blk: &fn(&str)) { blk(self.name) } + fn name(&self, blk: |&str|) { blk(self.name) } fn num_legs(&self) -> uint { 0 } fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 } } diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index f448bcb4ab5..90f87d832ff 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -24,10 +24,10 @@ fn to_string(&self) -> ~str { ~"()" } } trait map { - fn map(&self, f: &fn(&T) -> U) -> ~[U]; + fn map(&self, f: |&T| -> U) -> ~[U]; } impl map for ~[T] { - fn map(&self, f: &fn(&T) -> U) -> ~[U] { + fn map(&self, f: |&T| -> U) -> ~[U] { let mut r = ~[]; // FIXME: #7355 generates bad code with VecIterator for i in range(0u, self.len()) { diff --git a/src/test/run-pass/type-params-in-for-each.rs b/src/test/run-pass/type-params-in-for-each.rs index a5a9075af7b..042b5e96bbc 100644 --- a/src/test/run-pass/type-params-in-for-each.rs +++ b/src/test/run-pass/type-params-in-for-each.rs @@ -13,7 +13,7 @@ struct S { b: uint, } -fn range_(lo: uint, hi: uint, it: &fn(uint)) { +fn range_(lo: uint, hi: uint, it: |uint|) { let mut lo_ = lo; while lo_ < hi { it(lo_); lo_ += 1u; } } diff --git a/src/test/run-pass/unnamed_argument_mode.rs b/src/test/run-pass/unnamed_argument_mode.rs index c52658542f0..948824834df 100644 --- a/src/test/run-pass/unnamed_argument_mode.rs +++ b/src/test/run-pass/unnamed_argument_mode.rs @@ -3,7 +3,7 @@ fn good(_a: &int) { // unnamed argument &int is now parse x: &int -fn called(_f: &fn(&int)) { +fn called(_f: |&int|) { } pub fn main() { diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index 662121a0993..ceb91d557f6 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -10,6 +10,6 @@ pub fn main() { let _x = ~1; - let lam_move: &fn() = || {}; + let lam_move: || = || {}; lam_move(); } diff --git a/src/test/run-pass/variadic-ffi.rs b/src/test/run-pass/variadic-ffi.rs index d82e2890ae8..06026d58f60 100644 --- a/src/test/run-pass/variadic-ffi.rs +++ b/src/test/run-pass/variadic-ffi.rs @@ -15,7 +15,7 @@ fn sprintf(s: *mut c_char, format: *c_char, ...) -> c_int; } -unsafe fn check(expected: &str, f: &fn(*mut c_char) -> T) { +unsafe fn check(expected: &str, f: |*mut c_char| -> T) { let mut x = [0i8, ..50]; f(&mut x[0] as *mut c_char); let res = CString::new(&x[0], false); diff --git a/src/test/run-pass/vec-matching-fold.rs b/src/test/run-pass/vec-matching-fold.rs index 22f1ccb8bbb..75c48da8d81 100644 --- a/src/test/run-pass/vec-matching-fold.rs +++ b/src/test/run-pass/vec-matching-fold.rs @@ -1,6 +1,6 @@ fn foldl(values: &[T], initial: U, - function: &fn(partial: U, element: &T) -> U) + function: |partial: U, element: &T| -> U) -> U { match values { [ref head, ..tail] => @@ -11,7 +11,7 @@ fn foldl(values: &[T], fn foldr(values: &[T], initial: U, - function: &fn(element: &T, partial: U) -> U) + function: |element: &T, partial: U| -> U) -> U { match values { [..head, ref tail] => -- GitLab