diff --git a/doc/tutorial.md b/doc/tutorial.md
index 5dc5ef99916..b425c595f82 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -2291,13 +2291,12 @@ be private. But this encapsulation is at the module level, not the
struct level. Note that fields and methods are _public_ by default.
~~~
-mod farm {
-# use farm;
+pub mod farm {
# pub type Chicken = int;
# type Cow = int;
# enum Human = int;
# impl Human { fn rest(&self) { } }
-# pub fn make_me_a_farm() -> farm::Farm { farm::Farm { chickens: ~[], cows: ~[], farmer: Human(0) } }
+# pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], cows: ~[], farmer: Human(0) } }
pub struct Farm {
priv chickens: ~[Chicken],
priv cows: ~[Cow],
diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs
index 05244ad096a..a818ff58f94 100644
--- a/src/test/auxiliary/cci_nested_lib.rs
+++ b/src/test/auxiliary/cci_nested_lib.rs
@@ -14,7 +14,7 @@ use core::dvec::DVec;
pub struct Entry {key: A, value: B}
-pub struct alist { eq_fn: fn@(A,A) -> bool, data: DVec> }
+pub struct alist { eq_fn: @fn(A,A) -> bool, data: DVec> }
pub fn alist_add(lst: alist, k: A, v: B) {
lst.data.push(Entry{key:k, value:v});
diff --git a/src/test/auxiliary/issue4516_ty_param_lib.rs b/src/test/auxiliary/issue4516_ty_param_lib.rs
index 0e2105243e7..dd2ffd5002c 100644
--- a/src/test/auxiliary/issue4516_ty_param_lib.rs
+++ b/src/test/auxiliary/issue4516_ty_param_lib.rs
@@ -9,5 +9,6 @@
// except according to those terms.
pub fn to_closure(x: A) -> @fn() -> A {
- fn@() -> A { copy x }
+ let result: @fn() -> A = || copy x;
+ result
}
diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs
index bd8757d51b7..e026e78ffb8 100644
--- a/src/test/bench/core-std.rs
+++ b/src/test/bench/core-std.rs
@@ -16,7 +16,7 @@ use std::time::precise_time_s;
use std::oldmap;
use std::oldmap::{Map, HashMap};
-use io::{Reader, ReaderUtil};
+use core::io::{Reader, ReaderUtil};
macro_rules! bench (
($id:ident) => (maybe_run_test(argv, stringify!($id).to_owned(), $id))
diff --git a/src/test/bench/core-vec-append.rs b/src/test/bench/core-vec-append.rs
index 1dfcb31f196..7f1f4bd1834 100644
--- a/src/test/bench/core-vec-append.rs
+++ b/src/test/bench/core-vec-append.rs
@@ -11,8 +11,8 @@
// A raw test of vector appending performance.
extern mod std;
-use dvec::DVec;
-use io::WriterUtil;
+use core::dvec::DVec;
+use core::io::WriterUtil;
fn collect_raw(num: uint) -> ~[uint] {
let mut result = ~[];
diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs
index 52d08c548d7..0b172011648 100644
--- a/src/test/bench/graph500-bfs.rs
+++ b/src/test/bench/graph500-bfs.rs
@@ -267,7 +267,7 @@ fn pbfs(&&graph: arc::ARC, key: node_id) -> bfs_result {
colors = do par::mapi(*color_vec) {
let colors = arc::clone(&color);
let graph = arc::clone(&graph);
- fn~(+i: uint, +c: &color) -> color {
+ let result: ~fn(+x: uint, +y: &color) -> color = |i, c| {
let colors = arc::get(&colors);
let graph = arc::get(&graph);
match *c {
@@ -290,20 +290,22 @@ fn pbfs(&&graph: arc::ARC, key: node_id) -> bfs_result {
gray(parent) => { black(parent) }
black(parent) => { black(parent) }
}
- }
+ };
+ result
};
assert(colors.len() == old_len);
}
// Convert the results.
do par::map(colors) {
- fn~(c: &color) -> i64 {
+ let result: ~fn(c: &color) -> i64 = |c| {
match *c {
white => { -1i64 }
black(parent) => { parent }
_ => { fail!(~"Found remaining gray nodes in BFS") }
}
- }
+ };
+ result
}
}
@@ -387,14 +389,15 @@ fn validate(edges: ~[(node_id, node_id)],
let status = do par::alli(tree) {
let edges = copy edges;
- fn~(+u: uint, v: &i64) -> bool {
+ let result: ~fn(+x: uint, v: &i64) -> bool = |u, v| {
let u = u as node_id;
if *v == -1i64 || u == root {
true
} else {
edges.contains(&(u, *v)) || edges.contains(&(*v, u))
}
- }
+ };
+ result
};
if !status { return status }
diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs
index 4bbd22786a5..fbd80d58130 100644
--- a/src/test/bench/msgsend-pipes-shared.rs
+++ b/src/test/bench/msgsend-pipes-shared.rs
@@ -21,10 +21,10 @@
#[legacy_modes];
extern mod std;
-use io::Writer;
-use io::WriterUtil;
+use core::io::Writer;
+use core::io::WriterUtil;
-use comm::{Port, Chan, SharedChan};
+use core::comm::{Port, Chan, SharedChan};
macro_rules! move_out (
{ $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }
diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs
index a969368ebac..25135383745 100644
--- a/src/test/bench/msgsend-pipes.rs
+++ b/src/test/bench/msgsend-pipes.rs
@@ -17,10 +17,10 @@
#[legacy_modes];
extern mod std;
-use io::Writer;
-use io::WriterUtil;
+use core::io::Writer;
+use core::io::WriterUtil;
-use comm::{Port, PortSet, Chan, stream};
+use core::comm::{Port, PortSet, Chan, stream};
macro_rules! move_out (
{ $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 509861e2f47..2bc89f64a29 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -16,7 +16,7 @@
* http://shootout.alioth.debian.org/
*/
extern mod std;
-use io::WriterUtil;
+use core::io::WriterUtil;
fn LINE_LENGTH() -> uint { return 60u; }
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index 3fe5f705705..35c6694ee0c 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -17,9 +17,9 @@ extern mod std;
use std::oldmap;
use std::oldmap::HashMap;
use std::sort;
-use io::ReaderUtil;
-use comm::{stream, Port, Chan};
-use cmp::Ord;
+use core::io::ReaderUtil;
+use core::comm::{stream, Port, Chan};
+use core::cmp::Ord;
// given a map, print a sorted version of it
fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs
index a52b7889017..146a4b8c869 100644
--- a/src/test/bench/shootout-mandelbrot.rs
+++ b/src/test/bench/shootout-mandelbrot.rs
@@ -24,7 +24,7 @@
//
// writes pbm image to output path
-use io::WriterUtil;
+use core::io::WriterUtil;
use core::hashmap::linear::LinearMap;
struct cmplx {
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index e7b3547ab8c..f4127e6c772 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -45,7 +45,7 @@ fn main() {
io::println(fmt!("%f", NBodySystem::energy(bodies)));
}
-mod NBodySystem {
+pub mod NBodySystem {
use Body;
pub fn make() -> ~[Body::Props] {
@@ -162,7 +162,7 @@ mod NBodySystem {
}
}
-mod Body {
+pub mod Body {
use Body;
pub const PI: float = 3.141592653589793;
diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs
index 28533821365..e0d2fbb0513 100644
--- a/src/test/bench/shootout-pfib.rs
+++ b/src/test/bench/shootout-pfib.rs
@@ -29,7 +29,7 @@ use core::comm::*;
use core::io::WriterUtil;
use core::result;
-use result::{Ok, Err};
+use core::result::{Ok, Err};
fn fib(n: int) -> int {
fn pfib(c: Chan, n: int) {
diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs
index 0687799cf28..d54376a2532 100644
--- a/src/test/bench/std-smallintmap.rs
+++ b/src/test/bench/std-smallintmap.rs
@@ -12,7 +12,7 @@
extern mod std;
use std::smallintmap::SmallIntMap;
-use io::WriterUtil;
+use core::io::WriterUtil;
fn append_sequential(min: uint, max: uint, map: &mut SmallIntMap) {
for uint::range(min, max) |i| {
diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs
index 05dac339177..dc8136bc122 100644
--- a/src/test/bench/sudoku.rs
+++ b/src/test/bench/sudoku.rs
@@ -13,7 +13,8 @@
extern mod std;
use std::bitv;
-use io::{ReaderUtil, WriterUtil};
+use core::io::{ReaderUtil, WriterUtil};
+use core::io;
// Computes a single solution to a given 9x9 sudoku
//
diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs
index b4b02c3aaa8..05781b20a9b 100644
--- a/src/test/bench/task-perf-alloc-unwind.rs
+++ b/src/test/bench/task-perf-alloc-unwind.rs
@@ -46,7 +46,7 @@ type nillist = List<()>;
struct State {
box: @nillist,
unique: ~nillist,
- fn_box: fn@() -> @nillist,
+ fn_box: @fn() -> @nillist,
tuple: (@nillist, ~nillist),
vec: ~[@nillist],
res: r
@@ -78,7 +78,7 @@ fn recurse_or_fail(depth: int, st: Option) {
State {
box: @Nil,
unique: ~Nil,
- fn_box: fn@() -> @nillist { @Nil::<()> },
+ fn_box: || @Nil::<()>,
tuple: (@Nil, ~Nil),
vec: ~[@Nil],
res: r(@Nil)
@@ -90,7 +90,7 @@ fn recurse_or_fail(depth: int, st: Option) {
State {
box: @Cons((), st.box),
unique: ~Cons((), @*st.unique),
- fn_box: fn@() -> @nillist { @Cons((), fn_box()) },
+ fn_box: || @Cons((), fn_box()),
tuple: (@Cons((), st.tuple.first()),
~Cons((), @*st.tuple.second())),
vec: st.vec + ~[@Cons((), st.vec.last())],
diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs
index c6074cc522e..40390ceeee4 100644
--- a/src/test/bench/task-perf-linked-failure.rs
+++ b/src/test/bench/task-perf-linked-failure.rs
@@ -46,7 +46,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: ~fn()) {
let mut res = None;
task::task().future_result(|+r| res = Some(r)).supervised().spawn(f);
error!("%s group waiting", myname);
diff --git a/src/test/compile-fail/assign-to-method.rs b/src/test/compile-fail/assign-to-method.rs
index 0a2834a95e6..2436e4da8df 100644
--- a/src/test/compile-fail/assign-to-method.rs
+++ b/src/test/compile-fail/assign-to-method.rs
@@ -28,5 +28,5 @@ fn cat(in_x : uint, in_y : int) -> cat {
fn main() {
let nyan : cat = cat(52u, 99);
- nyan.speak = fn@() { debug!("meow"); }; //~ ERROR attempted to take value of method
+ nyan.speak = || debug!("meow"); //~ ERROR attempted to take value of method
}
diff --git a/src/test/compile-fail/borrowck-addr-of-upvar.rs b/src/test/compile-fail/borrowck-addr-of-upvar.rs
index 8bd3832d70c..4e8af4f0421 100644
--- a/src/test/compile-fail/borrowck-addr-of-upvar.rs
+++ b/src/test/compile-fail/borrowck-addr-of-upvar.rs
@@ -8,16 +8,19 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: @int) -> fn@() -> &static/int {
- fn@() -> &static/int {&*x} //~ ERROR illegal borrow
+fn foo(x: @int) -> @fn() -> &static/int {
+ let result: @fn() -> &static/int = || &*x; //~ ERROR illegal borrow
+ result
}
-fn bar(x: @int) -> fn@() -> &int {
- fn@() -> &int {&*x} //~ ERROR illegal borrow
+fn bar(x: @int) -> @fn() -> &int {
+ let result: @fn() -> &int = || &*x; //~ ERROR illegal borrow
+ result
}
-fn zed(x: @int) -> fn@() -> int {
- fn@() -> int {*&*x}
+fn zed(x: @int) -> @fn() -> int {
+ let result: @fn() -> int = || *&*x;
+ result
}
fn main() {
diff --git a/src/test/compile-fail/borrowck-call-sendfn.rs b/src/test/compile-fail/borrowck-call-sendfn.rs
index 51047631ea6..8dc86c9a163 100644
--- a/src/test/compile-fail/borrowck-call-sendfn.rs
+++ b/src/test/compile-fail/borrowck-call-sendfn.rs
@@ -10,7 +10,11 @@
// xfail-test #2978
-fn call(x: @{f: fn~()}) {
+struct Foo {
+ f: ~fn()
+}
+
+fn call(x: @Foo) {
x.f(); //~ ERROR foo
//~^ NOTE bar
}
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 50bedc57340..aca63308d87 100644
--- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
+++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
@@ -22,7 +22,7 @@ fn box_imm() {
let v = ~3;
let _w = &v; //~ NOTE loan of immutable local variable granted here
- task::spawn(fn~() {
+ task::spawn(|| {
debug!("v=%d", *v);
//~^ ERROR by-move capture of immutable local variable prohibited due to outstanding loan
});
diff --git a/src/test/compile-fail/do2.rs b/src/test/compile-fail/do2.rs
index 5fb5f15806d..10311834915 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: @fn(int) -> bool) -> bool { f(10i) }
fn main() {
assert do f() |i| { i == 10i } == 10i;
diff --git a/src/test/compile-fail/fn-variance-2.rs b/src/test/compile-fail/fn-variance-2.rs
index 979dfac9a4d..2a30f9fb96f 100644
--- a/src/test/compile-fail/fn-variance-2.rs
+++ b/src/test/compile-fail/fn-variance-2.rs
@@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn reproduce(t: T) -> fn@() -> T {
- fn@() -> T { t }
+fn reproduce(t: T) -> @fn() -> T {
+ let result: @fn() -> T = || t;
+ result
}
fn main() {
@@ -17,7 +18,7 @@ fn main() {
// with the lower bound @mut int
let x = @mut 3;
- // type of r is fn@() -> X
+ // type of r is @fn() -> X
let r = reproduce(x);
// Requires that X be a subtype of
diff --git a/src/test/compile-fail/fn-variance-3.rs b/src/test/compile-fail/fn-variance-3.rs
index 7f7e1f2fc84..5df2007721d 100644
--- a/src/test/compile-fail/fn-variance-3.rs
+++ b/src/test/compile-fail/fn-variance-3.rs
@@ -8,12 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn mk_identity() -> fn@(T) -> T {
- fn@(t: T) -> T { t }
+fn mk_identity() -> @fn(T) -> T {
+ let result: @fn(t: T) -> T = |t| t;
+ result
}
fn main() {
- // type of r is fn@(X) -> X
+ // type of r is @fn(X) -> X
// for some fresh X
let r = mk_identity();
diff --git a/src/test/compile-fail/issue-1451.rs b/src/test/compile-fail/issue-1451.rs
index 2e80a7b09de..acc371076e7 100644
--- a/src/test/compile-fail/issue-1451.rs
+++ b/src/test/compile-fail/issue-1451.rs
@@ -9,8 +9,8 @@
// except according to those terms.
// xfail-test
-struct T { f: fn@() };
-struct S { f: fn@() };
+struct T { f: @fn() };
+struct S { f: @fn() };
fn fooS(t: S) {
}
@@ -22,11 +22,11 @@ fn bar() {
}
fn main() {
- let x: fn@() = bar;
+ let x: @fn() = bar;
fooS(S {f: x});
fooS(S {f: bar});
- let x: fn@() = bar;
+ let x: @fn() = bar;
fooT(T {f: x});
fooT(T {f: bar});
}
diff --git a/src/test/compile-fail/issue-1896-1.rs b/src/test/compile-fail/issue-1896-1.rs
index 2be04929dc6..af379495731 100644
--- a/src/test/compile-fail/issue-1896-1.rs
+++ b/src/test/compile-fail/issue-1896-1.rs
@@ -8,10 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-struct boxedFn { theFn: fn~() -> uint }
+struct boxedFn { theFn: ~fn() -> uint }
fn createClosure (closedUint: uint) -> boxedFn {
- boxedFn {theFn: fn@ () -> uint { closedUint }} //~ ERROR mismatched types
+ let result: @fn() -> uint = || closedUint;
+ boxedFn { theFn: result } //~ ERROR mismatched types
}
fn main () {
diff --git a/src/test/compile-fail/issue-2074.rs b/src/test/compile-fail/issue-2074.rs
index be9eea8f72d..40c2772f234 100644
--- a/src/test/compile-fail/issue-2074.rs
+++ b/src/test/compile-fail/issue-2074.rs
@@ -10,13 +10,13 @@
// xfail-test
fn main() {
- let one = fn@() -> uint {
+ let one: @fn() -> uint = || {
enum r { a };
- return a as uint;
+ a as uint
};
- let two = fn@() -> uint {
+ let two = @fn() -> uint = || {
enum r { a };
- return a as uint;
+ a as uint
};
one(); two();
}
diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs
index 397b0f682d6..928abae2423 100644
--- a/src/test/compile-fail/kindck-nonsendable-1.rs
+++ b/src/test/compile-fail/kindck-nonsendable-1.rs
@@ -12,7 +12,7 @@ fn foo(_x: @uint) {}
fn main() {
let x = @3u;
- let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
- let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
- let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
+ let _: ~fn() = || foo(x); //~ ERROR value has non-owned type `@uint`
+ let _: ~fn() = || foo(x); //~ ERROR value has non-owned type `@uint`
+ let _: ~fn() = || foo(x); //~ ERROR value has non-owned type `@uint`
}
diff --git a/src/test/compile-fail/kindck-owned.rs b/src/test/compile-fail/kindck-owned.rs
index e792917622b..31ab555b38a 100644
--- a/src/test/compile-fail/kindck-owned.rs
+++ b/src/test/compile-fail/kindck-owned.rs
@@ -8,12 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn copy1(t: T) -> fn@() -> T {
- fn@() -> T { t } //~ ERROR value may contain borrowed pointers
+fn copy1(t: T) -> @fn() -> T {
+ let result: @fn() -> T = || t; //~ ERROR value may contain borrowed pointers
+ result
}
-fn copy2(t: T) -> fn@() -> T {
- fn@() -> T { t }
+fn copy2(t: T) -> @fn() -> T {
+ let result: @fn() -> T = || t;
+ result
}
fn main() {
@@ -23,7 +25,10 @@ fn main() {
copy2(@3);
copy2(@&x); //~ ERROR does not fulfill `&static`
- copy2(fn@() {});
- copy2(fn~() {}); //~ ERROR does not fulfill `Copy`
- copy2(fn&() {}); //~ ERROR does not fulfill `&static`
+ let boxed: @fn() = || {};
+ copy2(boxed);
+ let owned: ~fn() = || {};
+ copy2(owned); //~ ERROR does not fulfill `Copy`
+ let borrowed: &fn() = || {};
+ copy2(borrowed); //~ ERROR does not fulfill `&static`
}
diff --git a/src/test/compile-fail/lambda-mutate-nested.rs b/src/test/compile-fail/lambda-mutate-nested.rs
index e52444ba293..1ed18a0297a 100644
--- a/src/test/compile-fail/lambda-mutate-nested.rs
+++ b/src/test/compile-fail/lambda-mutate-nested.rs
@@ -9,13 +9,13 @@
// except according to those terms.
// error-pattern:assigning to captured outer immutable variable in a stack closure
-// Make sure that nesting a block within a fn@ doesn't let us
-// mutate upvars from a fn@.
-fn f2(x: fn()) { x(); }
+// Make sure that nesting a block within a @fn doesn't let us
+// mutate upvars from a @fn.
+fn f2(x: &fn()) { x(); }
fn main() {
let i = 0;
- let ctr = fn@ () -> int { f2(|| i = i + 1 ); return i; };
+ let ctr: @fn() -> int = || { f2(|| i = i + 1 ); i };
log(error, ctr());
log(error, ctr());
log(error, ctr());
diff --git a/src/test/compile-fail/lambda-mutate.rs b/src/test/compile-fail/lambda-mutate.rs
index 8de90f489a3..eaa51a8c3dd 100644
--- a/src/test/compile-fail/lambda-mutate.rs
+++ b/src/test/compile-fail/lambda-mutate.rs
@@ -9,10 +9,10 @@
// except according to those terms.
// error-pattern:assigning to captured outer variable in a heap closure
-// Make sure we can't write to upvars from fn@s
+// Make sure we can't write to upvars from @fns
fn main() {
let i = 0;
- let ctr = fn@ () -> int { i = i + 1; return i; };
+ let ctr: @fn() -> int = || { i = i + 1; i };
log(error, ctr());
log(error, ctr());
log(error, ctr());
diff --git a/src/test/compile-fail/liveness-block-unint.rs b/src/test/compile-fail/liveness-block-unint.rs
index e090e8d0b35..75815d2643c 100644
--- a/src/test/compile-fail/liveness-block-unint.rs
+++ b/src/test/compile-fail/liveness-block-unint.rs
@@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn force(f: fn()) { f(); }
+fn force(f: &fn()) { f(); }
fn main() {
let x: int;
- force(fn&() {
+ force(|| {
log(debug, x); //~ ERROR capture of possibly uninitialized variable: `x`
});
}
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 f83d582923a..1fddea80966 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,9 +9,9 @@
// except according to those terms.
fn main() {
- let j = fn@() -> int {
+ let j: @fn() -> int = || {
let i: int;
- return i; //~ ERROR use of possibly uninitialized variable: `i`
+ i //~ ERROR use of possibly uninitialized variable: `i`
};
j();
}
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 308430cffaa..13b8fb04a42 100644
--- a/src/test/compile-fail/liveness-init-in-fn-expr.rs
+++ b/src/test/compile-fail/liveness-init-in-fn-expr.rs
@@ -9,9 +9,9 @@
// except according to those terms.
fn main() {
- let f = fn@() -> int {
+ let f: @fn() -> int = || {
let i: int;
- return i; //~ ERROR use of possibly uninitialized variable: `i`
+ i //~ ERROR use of possibly uninitialized variable: `i`
};
log(error, f());
}
diff --git a/src/test/compile-fail/liveness-issue-2163.rs b/src/test/compile-fail/liveness-issue-2163.rs
index fb317a3988e..914b7d9d677 100644
--- a/src/test/compile-fail/liveness-issue-2163.rs
+++ b/src/test/compile-fail/liveness-issue-2163.rs
@@ -10,7 +10,7 @@
fn main() {
let a: ~[int] = ~[];
- vec::each(a, fn@(_x: &int) -> bool {
- //~^ ERROR not all control paths return a value
+ vec::each(a, |_| -> bool {
+ //~^ ERROR mismatched types
});
}
diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs
index 970abf4fd94..9e4d16f96e6 100644
--- a/src/test/compile-fail/liveness-unused.rs
+++ b/src/test/compile-fail/liveness-unused.rs
@@ -68,5 +68,5 @@ impl Drop for r {
fn main() {
let x = r { x: () };
- fn@() { copy x; }; //~ ERROR copying a value of non-copyable type
+ || { copy x; }; //~ ERROR copying a value of non-copyable type
}
diff --git a/src/test/compile-fail/omitted-arg-wrong-types.rs b/src/test/compile-fail/omitted-arg-wrong-types.rs
index 13087e05d0b..d432c5eac46 100644
--- a/src/test/compile-fail/omitted-arg-wrong-types.rs
+++ b/src/test/compile-fail/omitted-arg-wrong-types.rs
@@ -9,12 +9,12 @@
// except according to those terms.
// xfail-test - #2093
-fn let_in(x: T, f: fn(T)) {}
+fn let_in(x: T, f: &fn(T)) {}
fn main() {
- let_in(3u, fn&(i) { assert i == 3; });
+ let_in(3u, |i| { assert i == 3; });
//~^ ERROR expected `uint` but found `int`
- let_in(3, fn&(i) { assert i == 3u; });
+ let_in(3, |i| { assert i == 3u; });
//~^ ERROR expected `int` but found `uint`
}
diff --git a/src/test/compile-fail/pure-subtyping.rs b/src/test/compile-fail/pure-subtyping.rs
index ad3bea0055b..2744afb113d 100644
--- a/src/test/compile-fail/pure-subtyping.rs
+++ b/src/test/compile-fail/pure-subtyping.rs
@@ -12,36 +12,36 @@
fn take(_v: T) {}
-fn assign_to_pure(x: pure fn(), y: fn(), z: unsafe fn()) {
- take::(x);
- take::(y); //~ ERROR expected pure fn but found impure fn
- take::(z); //~ ERROR expected pure fn but found unsafe fn
+fn assign_to_pure(x: &pure fn(), y: &fn(), z: &unsafe fn()) {
+ take::<&pure fn()>(x);
+ take::<&pure fn()>(y); //~ ERROR expected pure fn but found impure fn
+ take::<&pure fn()>(z); //~ ERROR expected pure fn but found unsafe fn
}
-fn assign_to_impure(x: pure fn(), y: fn(), z: unsafe fn()) {
- take::(x);
- take::(y);
- take::(z); //~ ERROR expected impure fn but found unsafe fn
+fn assign_to_impure(x: &pure fn(), y: &fn(), z: &unsafe fn()) {
+ take::<&fn()>(x);
+ take::<&fn()>(y);
+ take::<&fn()>(z); //~ ERROR expected impure fn but found unsafe fn
}
-fn assign_to_unsafe(x: pure fn(), y: fn(), z: unsafe fn()) {
- take::(x);
- take::(y);
- take::(z);
+fn assign_to_unsafe(x: &pure fn(), y: &fn(), z: &unsafe fn()) {
+ take::<&unsafe fn()>(x);
+ take::<&unsafe fn()>(y);
+ take::<&unsafe fn()>(z);
}
-fn assign_to_pure2(x: pure fn@(), y: fn@(), z: unsafe fn@()) {
- take::(x);
- take::(y); //~ ERROR expected pure fn but found impure fn
- take::(z); //~ ERROR expected pure fn but found unsafe fn
+fn assign_to_pure2(x: @pure fn(), y: @fn(), z: @unsafe fn()) {
+ take::<&pure fn()>(x);
+ take::<&pure fn()>(y); //~ ERROR expected pure fn but found impure fn
+ take::<&pure fn()>(z); //~ ERROR expected pure fn but found unsafe fn
- take::(x); //~ ERROR expected ~ closure, found @ closure
- take::(y); //~ ERROR expected ~ closure, found @ closure
- take::(z); //~ ERROR expected ~ closure, found @ closure
+ take::<~pure fn()>(x); //~ ERROR expected ~ closure, found @ closure
+ take::<~pure fn()>(y); //~ ERROR expected ~ closure, found @ closure
+ take::<~pure fn()>(z); //~ ERROR expected ~ closure, found @ closure
- take::(x); //~ ERROR expected ~ closure, found @ closure
- take::(y); //~ ERROR expected ~ closure, found @ closure
- take::(z); //~ ERROR expected ~ closure, found @ closure
+ take::<~unsafe fn()>(x); //~ ERROR expected ~ closure, found @ closure
+ take::<~unsafe fn()>(y); //~ ERROR expected ~ closure, found @ closure
+ take::<~unsafe fn()>(z); //~ ERROR expected ~ closure, found @ closure
}
fn main() {
diff --git a/src/test/compile-fail/regions-fns.rs b/src/test/compile-fail/regions-fns.rs
index 914dd22720b..a4f1825fcae 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(a: &uint, b: &b/uint) {
- let mut g: fn@(x: &uint) = fn@(x: &b/uint) {};
+ let mut g: @fn(x: &uint) = |x: &b/uint| {};
//~^ ERROR mismatched types
g(a);
}
diff --git a/src/test/compile-fail/regions-infer-contravariance-due-to-ret.rs b/src/test/compile-fail/regions-infer-contravariance-due-to-ret.rs
index 5c57fe26c24..936aa79d032 100644
--- a/src/test/compile-fail/regions-infer-contravariance-due-to-ret.rs
+++ b/src/test/compile-fail/regions-infer-contravariance-due-to-ret.rs
@@ -14,7 +14,7 @@
// the normal case.
struct contravariant {
- f: fn@() -> &self/int
+ f: @fn() -> &self/int
}
fn to_same_lifetime(bi: contravariant/&r) {
diff --git a/src/test/compile-fail/regions-infer-covariance-due-to-arg.rs b/src/test/compile-fail/regions-infer-covariance-due-to-arg.rs
index a7363867ddc..27e1452d957 100644
--- a/src/test/compile-fail/regions-infer-covariance-due-to-arg.rs
+++ b/src/test/compile-fail/regions-infer-covariance-due-to-arg.rs
@@ -13,7 +13,7 @@
// You can upcast to a *larger region* but not a smaller one.
struct covariant {
- f: fn@(x: &self/int) -> int
+ f: @fn(x: &self/int) -> int
}
fn to_same_lifetime(bi: covariant/&r) {
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
index 3d831f02a91..c84afc6ca64 100644
--- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
+++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
@@ -9,7 +9,7 @@
// except according to those terms.
struct invariant {
- f: fn@(x: @mut &self/int)
+ f: @fn(x: @mut &self/int)
}
fn to_same_lifetime(bi: invariant/&r) {
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
index 2c232f70bc4..b958aa70aa4 100644
--- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
+++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
@@ -9,7 +9,7 @@
// except according to those terms.
struct invariant {
- f: fn@() -> @mut &self/int
+ f: @fn() -> @mut &self/int
}
fn to_same_lifetime(bi: invariant/&r) {
diff --git a/src/test/compile-fail/regions-infer-not-param.rs b/src/test/compile-fail/regions-infer-not-param.rs
index 33916a543cd..ca105a1dd5e 100644
--- a/src/test/compile-fail/regions-infer-not-param.rs
+++ b/src/test/compile-fail/regions-infer-not-param.rs
@@ -13,15 +13,15 @@ struct direct {
}
struct indirect1 {
- g: fn@(direct)
+ g: @fn(direct)
}
struct indirect2 {
- g: fn@(direct/&)
+ g: @fn(direct/&)
}
struct indirect3 {
- g: fn@(direct/&self)
+ g: @fn(direct/&self)
}
fn take_direct(p: direct) -> direct { p } //~ ERROR mismatched types
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 7b8b8daf565..11414a11108 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
-enum foo = fn~(x: &int);
+enum foo = ~fn(x: &int);
fn take_foo(x: foo/&) {} //~ ERROR no region bound is allowed on `foo`
diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/compile-fail/regions-nested-fns-2.rs
index ee2aea1086b..b4cbbacea3f 100644
--- a/src/test/compile-fail/regions-nested-fns-2.rs
+++ b/src/test/compile-fail/regions-nested-fns-2.rs
@@ -12,9 +12,8 @@ fn ignore(_t: T) {}
fn nested() {
let y = 3;
- ignore(fn&(z: &z/int) -> &z/int {
- if false { return &y; } //~ ERROR illegal borrow
- return z;
+ ignore(|z: &z/int| -> &z/int {
+ if false { &y } else { z } //~ ERROR illegal borrow
});
}
diff --git a/src/test/compile-fail/regions-nested-fns.rs b/src/test/compile-fail/regions-nested-fns.rs
index 4d53db35596..714b863ca1d 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/int) {
let y = 3;
let mut ay = &y; //~ ERROR cannot infer an appropriate lifetime
- ignore(fn&(z: &z/int) {
+ ignore(|z: &z/int| {
ay = x;
ay = &y; //~ ERROR cannot infer an appropriate lifetime
ay = z;
});
- ignore(fn&(z: &z/int) -> &z/int {
+ ignore(|z: &z/int| -> &z/int {
if false { return x; } //~ ERROR mismatched types
if false { return ay; }
return z;
diff --git a/src/test/compile-fail/regions-scoping.rs b/src/test/compile-fail/regions-scoping.rs
index 063bc32f7b4..66f1007afcf 100644
--- a/src/test/compile-fail/regions-scoping.rs
+++ b/src/test/compile-fail/regions-scoping.rs
@@ -12,13 +12,12 @@ fn with(t: T, f: fn(T)) { f(t) }
fn nested<'x>(x: &'x int) { // (1)
do with(
- fn&(x: &'x int, // Refers to the region `x` at (1)
- y: &'y int, // A fresh region `y` (2)
- z: fn<'z>(x: &'x int, // Refers to `x` at (1)
- y: &'y int, // Refers to `y` at (2)
- z: &'z int) -> &'z int) // A fresh region `z` (3)
- -> &x/int {
-
+ |x: &'x int, // Refers to the region `x` at (1)
+ y: &'y int, // A fresh region `y` (2)
+ z: &fn<'z>(x: &'x int, // Refers to `x` at (1)
+ y: &'y int, // Refers to `y` at (2)
+ z: &'z int) -> &'z int| // A fresh region `z` (3)
+ -> &x/int {
if false { return z(x, y, x); }
if false { return z(x, y, y); }
diff --git a/src/test/compile-fail/sendfn-is-not-a-lambda.rs b/src/test/compile-fail/sendfn-is-not-a-lambda.rs
index 1c6b1310f37..33bb06e4f26 100644
--- a/src/test/compile-fail/sendfn-is-not-a-lambda.rs
+++ b/src/test/compile-fail/sendfn-is-not-a-lambda.rs
@@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn test(f: fn@(uint) -> uint) -> uint {
+fn test(f: @fn(uint) -> uint) -> uint {
return f(22u);
}
fn main() {
- let f = fn~(x: uint) -> uint { return 4u; };
+ let f: ~fn(x: uint) -> uint = |x| 4u;
log(debug, test(f)); //~ ERROR expected @ closure, found ~ closure
}
diff --git a/src/test/compile-fail/spawn-non-nil-fn.rs b/src/test/compile-fail/spawn-non-nil-fn.rs
index 88d865d8533..00e3e612e8f 100644
--- a/src/test/compile-fail/spawn-non-nil-fn.rs
+++ b/src/test/compile-fail/spawn-non-nil-fn.rs
@@ -12,4 +12,4 @@
extern mod std;
-fn main() { task::spawn(fn~() -> int { 10 }); }
+fn main() { task::spawn(|| -> int { 10 }); }
diff --git a/src/test/pretty/block-arg-disambig.rs b/src/test/pretty/block-arg-disambig.rs
index 16ada3de7b2..67fdfffe1d3 100644
--- a/src/test/pretty/block-arg-disambig.rs
+++ b/src/test/pretty/block-arg-disambig.rs
@@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn blk1(b: fn()) -> fn@() { return fn@() { }; }
+fn blk1(b: &fn()) -> @fn() { return || { }; }
fn test1() { (do blk1 { debug!("hi"); })(); }
diff --git a/src/test/run-fail/issue-2144.rs b/src/test/run-fail/issue-2144.rs
index d0599e3aaa6..56b7acc7f0f 100644
--- a/src/test/run-fail/issue-2144.rs
+++ b/src/test/run-fail/issue-2144.rs
@@ -13,7 +13,7 @@
// Don't leak when the landing pads need to request more stack
// than is allowed during normal execution
-fn useBlock(f: fn~() -> uint) { useBlock(|| 22u ) }
+fn useBlock(f: ~fn() -> uint) { useBlock(|| 22u ) }
fn main() {
useBlock(|| 22u );
}
diff --git a/src/test/run-fail/unwind-box-fn-unique.rs b/src/test/run-fail/unwind-box-fn-unique.rs
index 6128e96d7bc..326c304ef3b 100644
--- a/src/test/run-fail/unwind-box-fn-unique.rs
+++ b/src/test/run-fail/unwind-box-fn-unique.rs
@@ -16,9 +16,9 @@ fn failfn() {
fn main() {
let y = ~0;
- let x = @fn~() {
+ let x: @~fn() = @(|| {
log(error, copy y);
- };
+ });
failfn();
log(error, x);
}
diff --git a/src/test/run-fail/unwind-box-fn.rs b/src/test/run-fail/unwind-box-fn.rs
index e1d959694e2..a2227e6c94a 100644
--- a/src/test/run-fail/unwind-box-fn.rs
+++ b/src/test/run-fail/unwind-box-fn.rs
@@ -16,7 +16,7 @@ fn failfn() {
fn main() {
let y = ~0;
- let x = @fn@() {
+ let x: @@fn() = @|| {
log(error, copy y);
};
failfn();
diff --git a/src/test/run-fail/unwind-closure.rs b/src/test/run-fail/unwind-closure.rs
index 6d52046b3e2..b84ae2e94fc 100644
--- a/src/test/run-fail/unwind-closure.rs
+++ b/src/test/run-fail/unwind-closure.rs
@@ -16,6 +16,6 @@ fn f(a: @int) {
fn main() {
let b = @0;
- let g : fn@() = || f(b);
+ let g: @fn() = || f(b);
g();
}
diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs
index 1fff98c4338..f92f7874fc3 100644
--- a/src/test/run-fail/unwind-lambda.rs
+++ b/src/test/run-fail/unwind-lambda.rs
@@ -14,12 +14,13 @@ fn main() {
let cheese = ~"roquefort";
let carrots = @~"crunchy";
- fn@(tasties: @~str, macerate: fn(~str)) {
+ let result: @fn(@~str, &fn(~str)) = (|tasties, macerate| {
macerate(copy *tasties);
- } (carrots, |food| {
+ });
+ result(carrots, |food| {
let mush = food + cheese;
let cheese = copy cheese;
- let f = fn@() {
+ let f: &fn() = || {
let chew = mush + cheese;
fail!(~"so yummy")
};
diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs
index 2972c425192..0f19d4ee16b 100644
--- a/src/test/run-pass/alignment-gep-tup-like-1.rs
+++ b/src/test/run-pass/alignment-gep-tup-like-1.rs
@@ -12,8 +12,9 @@ type pair = {
a: A, b: B
};
-fn f(a: A, b: u16) -> fn@() -> (A, u16) {
- fn@() -> (A, u16) { (a, b) }
+fn f(a: A, b: u16) -> @fn() -> (A, u16) {
+ let result: @fn() -> (A, u16) = || (a, b);
+ result
}
pub fn main() {
diff --git a/src/test/run-pass/alignment-gep-tup-like-2.rs b/src/test/run-pass/alignment-gep-tup-like-2.rs
index 2f008e51586..1de3fde58f2 100644
--- a/src/test/run-pass/alignment-gep-tup-like-2.rs
+++ b/src/test/run-pass/alignment-gep-tup-like-2.rs
@@ -23,8 +23,9 @@ fn make_cycle(a: A) {
g.rec = Some(g);
}
-fn f(a: A, b: B) -> fn@() -> (A, B) {
- fn@() -> (A, B) { (a, b) }
+fn f(a: A, b: B) -> @fn() -> (A, B) {
+ let result: @fn() -> (A, B) = || (a, b);
+ result
}
pub fn main() {
diff --git a/src/test/run-pass/block-arg-call-as.rs b/src/test/run-pass/block-arg-call-as.rs
index fd5662bd46b..1549eb6fbc2 100644
--- a/src/test/run-pass/block-arg-call-as.rs
+++ b/src/test/run-pass/block-arg-call-as.rs
@@ -10,19 +10,15 @@
extern mod std;
-fn asSendfn( f : fn~()->uint ) -> uint {
+fn asSendfn( f : ~fn()->uint ) -> uint {
return f();
}
-fn asLambda( f : fn@()->uint ) -> uint {
+fn asLambda( f : @fn()->uint ) -> uint {
return f();
}
-fn asBlock( f : fn&()->uint ) -> uint {
- return f();
-}
-
-fn asAny( f : fn()->uint ) -> uint {
+fn asBlock( f : &fn()->uint ) -> uint {
return f();
}
diff --git a/src/test/run-pass/block-arg-used-as-lambda.rs b/src/test/run-pass/block-arg-used-as-lambda.rs
index 20a1123ecf4..04adeb9c71b 100644
--- a/src/test/run-pass/block-arg-used-as-lambda.rs
+++ b/src/test/run-pass/block-arg-used-as-lambda.rs
@@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn to_lambda(f: fn@(uint) -> uint) -> fn@(uint) -> uint {
+fn to_lambda(f: @fn(uint) -> uint) -> @fn(uint) -> uint {
return f;
}
pub fn main() {
- let x: fn@(uint) -> uint = to_lambda(|x| x * 2u );
+ let x: @fn(uint) -> uint = to_lambda(|x| x * 2u );
let y = to_lambda(x);
let x_r = x(22u);
diff --git a/src/test/run-pass/cap-clause-move.rs b/src/test/run-pass/cap-clause-move.rs
index e27434400c1..7089e596619 100644
--- a/src/test/run-pass/cap-clause-move.rs
+++ b/src/test/run-pass/cap-clause-move.rs
@@ -11,21 +11,21 @@
pub fn main() {
let x = ~1;
let y = ptr::addr_of(&(*x)) as uint;
- let lam_move = fn@() -> uint { ptr::addr_of(&(*x)) as uint };
+ let lam_move: @fn() -> uint = || ptr::addr_of(&(*x)) as uint;
assert lam_move() == y;
let x = ~2;
let y = ptr::addr_of(&(*x)) as uint;
- let lam_move: fn@() -> uint = || ptr::addr_of(&(*x)) as uint;
+ let lam_move: @fn() -> uint = || ptr::addr_of(&(*x)) as uint;
assert lam_move() == y;
let x = ~3;
let y = ptr::addr_of(&(*x)) as uint;
- let snd_move = fn~() -> uint { ptr::addr_of(&(*x)) as uint };
+ let snd_move: ~fn() -> uint = || ptr::addr_of(&(*x)) as uint;
assert snd_move() == y;
let x = ~4;
let y = ptr::addr_of(&(*x)) as uint;
- let lam_move: fn~() -> uint = || ptr::addr_of(&(*x)) as uint;
+ let lam_move: ~fn() -> uint = || ptr::addr_of(&(*x)) as uint;
assert lam_move() == y;
}
diff --git a/src/test/run-pass/class-implements-multiple-traits.rs b/src/test/run-pass/class-implements-multiple-traits.rs
index a05b74c9a3c..4b2c2d0d308 100644
--- a/src/test/run-pass/class-implements-multiple-traits.rs
+++ b/src/test/run-pass/class-implements-multiple-traits.rs
@@ -58,10 +58,8 @@ class cat : noisy, scratchy, bitey {
new(in_x : uint, in_y : int, in_name: str)
{ self.meows = @mut in_x; self.how_hungry = @mut in_y;
self.name = in_name; self.scratched = dvec();
- let hsher: hashfn =
- fn@(p: body_part) -> uint { int::hash(p as int) };
- let eqer : eqfn =
- fn@(p: body_part, q: body_part) -> bool { p == q };
+ let hsher: hashfn = |p| int::hash(p as int);
+ let eqer : eqfn = |p, q| p == q;
let t : hashmap =
hashmap::(hsher, eqer);
self.bite_counts = t;
diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs
index 32f39177e1c..8c31b39ac28 100644
--- a/src/test/run-pass/close-over-big-then-small-data.rs
+++ b/src/test/run-pass/close-over-big-then-small-data.rs
@@ -16,8 +16,9 @@ type pair = {
a: A, b: B
};
-fn f(a: A, b: u16) -> fn@() -> (A, u16) {
- fn@() -> (A, u16) { (a, b) }
+fn f(a: A, b: u16) -> @fn() -> (A, u16) {
+ let result: @fn() -> (A, u16) = || (a, b);
+ result
}
pub fn main() {
diff --git a/src/test/run-pass/cycle-collection2.rs b/src/test/run-pass/cycle-collection2.rs
index 125c3ba1027..cd148417f4c 100644
--- a/src/test/run-pass/cycle-collection2.rs
+++ b/src/test/run-pass/cycle-collection2.rs
@@ -8,13 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-struct foo { z: fn@() }
+struct foo { z: @fn() }
fn nop() { }
fn nop_foo(_x : @mut foo) { }
pub fn main() {
let w = @mut foo{ z: || nop() };
- let x: fn@() = || nop_foo(w);
+ let x: @fn() = || nop_foo(w);
w.z = x;
}
diff --git a/src/test/run-pass/cycle-collection4.rs b/src/test/run-pass/cycle-collection4.rs
index 8a3139157fd..8b613093944 100644
--- a/src/test/run-pass/cycle-collection4.rs
+++ b/src/test/run-pass/cycle-collection4.rs
@@ -8,13 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-struct foo { z : fn@() }
+struct foo { z : @fn() }
fn nop() { }
fn nop_foo(_y: ~[int], _x : @mut foo) { }
pub fn main() {
let w = @mut foo{ z: || nop() };
- let x : fn@() = || nop_foo(~[], w);
+ let x : @fn() = || nop_foo(~[], w);
w.z = x;
}
diff --git a/src/test/run-pass/cycle-collection5.rs b/src/test/run-pass/cycle-collection5.rs
index fe0d294f01a..f724a86555c 100644
--- a/src/test/run-pass/cycle-collection5.rs
+++ b/src/test/run-pass/cycle-collection5.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-struct foo { z: fn@() }
+struct foo { z: @fn() }
fn nop() { }
fn nop_foo(_y: @int, _x: @mut foo) { }
@@ -17,6 +17,6 @@ fn o() -> @int { @10 }
pub fn main() {
let w = @mut foo { z: || nop() };
- let x : fn@() = || nop_foo(o(), w);
+ let x : @fn() = || nop_foo(o(), w);
w.z = x;
}
diff --git a/src/test/run-pass/do-for-no-args.rs b/src/test/run-pass/do-for-no-args.rs
index 745d941182e..c89d693c816 100644
--- a/src/test/run-pass/do-for-no-args.rs
+++ b/src/test/run-pass/do-for-no-args.rs
@@ -10,9 +10,9 @@
// Testing that we can drop the || in for/do exprs
-fn f(f: fn@() -> bool) { }
+fn f(f: @fn() -> bool) { }
-fn d(f: fn@()) { }
+fn d(f: @fn()) { }
pub fn main() {
for f { }
diff --git a/src/test/run-pass/do-stack.rs b/src/test/run-pass/do-stack.rs
index c42a0dc5739..b1113f5ad51 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: &fn(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 f6b00ce7881..a7a34d06f1e 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: @fn(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 1f0d82ec7b5..d82331c6045 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: @fn(int) -> int) -> int { f(10) }
pub fn main() {
assert do f() |i| { i } == 10;
diff --git a/src/test/run-pass/do3.rs b/src/test/run-pass/do3.rs
index f7660e35f59..09337d892a7 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: @fn(int) -> int) -> int { f(10) }
pub fn main() {
assert do f |i| { i } == 10;
diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs
index 5df155e4ad3..88c78e9e997 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 std;
*
* The hash should concentrate entropy in the lower bits.
*/
-type HashFn = pure fn~(K) -> uint;
-type EqFn = pure fn~(K, K) -> bool;
+type HashFn = ~pure fn(K) -> uint;
+type EqFn = ~pure fn(K, K) -> bool;
struct LM { resize_at: uint, size: uint }
diff --git a/src/test/run-pass/expr-alt-generic-box1.rs b/src/test/run-pass/expr-alt-generic-box1.rs
index 81e14b18638..7f477d3f103 100644
--- a/src/test/run-pass/expr-alt-generic-box1.rs
+++ b/src/test/run-pass/expr-alt-generic-box1.rs
@@ -12,7 +12,7 @@
// -*- rust -*-
-type compare = fn@(@T, @T) -> bool;
+type compare = @fn(@T, @T) -> bool;
fn test_generic(expected: @T, eq: compare) {
let actual: @T = match true { true => { expected }, _ => fail!() };
diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs
index e5c82f9edb0..5612cca639d 100644
--- a/src/test/run-pass/expr-alt-generic-box2.rs
+++ b/src/test/run-pass/expr-alt-generic-box2.rs
@@ -11,7 +11,7 @@
// xfail-fast
// -*- rust -*-
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, eq: compare) {
let actual: T = match true { true => { expected }, _ => fail!(~"wat") };
diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs
index ec51fabd4a7..3c1131455f1 100644
--- a/src/test/run-pass/expr-alt-generic-unique1.rs
+++ b/src/test/run-pass/expr-alt-generic-unique1.rs
@@ -11,7 +11,7 @@
// -*- rust -*-
-type compare = fn@(~T, ~T) -> bool;
+type compare = @fn(~T, ~T) -> bool;
fn test_generic(expected: ~T, eq: compare) {
let actual: ~T = match true {
diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs
index 7f1c2e17dd5..2d45e6a7a3e 100644
--- a/src/test/run-pass/expr-alt-generic-unique2.rs
+++ b/src/test/run-pass/expr-alt-generic-unique2.rs
@@ -11,7 +11,7 @@
// xfail-fast
// -*- rust -*-
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, eq: compare) {
let actual: T = match true {
diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs
index dcffcd0ad23..df7fbb8d5b2 100644
--- a/src/test/run-pass/expr-alt-generic.rs
+++ b/src/test/run-pass/expr-alt-generic.rs
@@ -11,7 +11,7 @@
// xfail-fast
// -*- rust -*-
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, eq: compare) {
let actual: T = match true { true => { expected }, _ => fail!(~"wat") };
diff --git a/src/test/run-pass/expr-block-fn.rs b/src/test/run-pass/expr-block-fn.rs
index fd69a702f1b..eb82a2a4445 100644
--- a/src/test/run-pass/expr-block-fn.rs
+++ b/src/test/run-pass/expr-block-fn.rs
@@ -11,7 +11,7 @@
fn test_fn() {
- type t = fn@() -> int;
+ type t = @fn() -> int;
fn ten() -> int { return 10; }
let rs: t = { ten };
//assert (rs() == 10);
diff --git a/src/test/run-pass/expr-block-generic-box1.rs b/src/test/run-pass/expr-block-generic-box1.rs
index 440a25b59cd..737ff99440d 100644
--- a/src/test/run-pass/expr-block-generic-box1.rs
+++ b/src/test/run-pass/expr-block-generic-box1.rs
@@ -12,7 +12,7 @@
// -*- rust -*-
-type compare = fn@(@T, @T) -> bool;
+type compare = @fn(@T, @T) -> bool;
fn test_generic(expected: @T, eq: compare) {
let actual: @T = { expected };
diff --git a/src/test/run-pass/expr-block-generic-box2.rs b/src/test/run-pass/expr-block-generic-box2.rs
index 3851578d547..eeda810b5c6 100644
--- a/src/test/run-pass/expr-block-generic-box2.rs
+++ b/src/test/run-pass/expr-block-generic-box2.rs
@@ -12,7 +12,7 @@
// xfail-fast
#[legacy_modes];
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, eq: compare) {
let actual: T = { expected };
diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs
index c4efe32a31e..a9074b6f97f 100644
--- a/src/test/run-pass/expr-block-generic-unique1.rs
+++ b/src/test/run-pass/expr-block-generic-unique1.rs
@@ -11,7 +11,7 @@
// -*- rust -*-
-type compare = fn@(~T, ~T) -> bool;
+type compare = @fn(~T, ~T) -> bool;
fn test_generic(expected: ~T, eq: compare) {
let actual: ~T = { copy expected };
diff --git a/src/test/run-pass/expr-block-generic-unique2.rs b/src/test/run-pass/expr-block-generic-unique2.rs
index b0a056e8891..6624e6ea015 100644
--- a/src/test/run-pass/expr-block-generic-unique2.rs
+++ b/src/test/run-pass/expr-block-generic-unique2.rs
@@ -12,7 +12,7 @@
// -*- rust -*-
#[legacy_modes];
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, eq: compare) {
let actual: T = { expected };
diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs
index ef726e47df3..63187bee76f 100644
--- a/src/test/run-pass/expr-block-generic.rs
+++ b/src/test/run-pass/expr-block-generic.rs
@@ -13,7 +13,7 @@
// xfail-fast
// Tests for standalone blocks as expressions with dynamic type sizes
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, eq: compare) {
let actual: T = { expected };
diff --git a/src/test/run-pass/expr-if-generic-box1.rs b/src/test/run-pass/expr-if-generic-box1.rs
index 16677886d09..fd5e88da730 100644
--- a/src/test/run-pass/expr-if-generic-box1.rs
+++ b/src/test/run-pass/expr-if-generic-box1.rs
@@ -12,7 +12,7 @@
// -*- rust -*-
-type compare = fn@(@T, @T) -> bool;
+type compare = @fn(@T, @T) -> bool;
fn test_generic(expected: @T, not_expected: @T, eq: compare) {
let actual: @T = if true { expected } else { not_expected };
diff --git a/src/test/run-pass/expr-if-generic-box2.rs b/src/test/run-pass/expr-if-generic-box2.rs
index 5a879071a88..08809d03515 100644
--- a/src/test/run-pass/expr-if-generic-box2.rs
+++ b/src/test/run-pass/expr-if-generic-box2.rs
@@ -12,7 +12,7 @@
// -*- rust -*-
#[legacy_modes];
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, not_expected: T, eq: compare) {
let actual: T = if true { expected } else { not_expected };
diff --git a/src/test/run-pass/expr-if-generic.rs b/src/test/run-pass/expr-if-generic.rs
index 4e52fec5c19..18cc4048242 100644
--- a/src/test/run-pass/expr-if-generic.rs
+++ b/src/test/run-pass/expr-if-generic.rs
@@ -12,7 +12,7 @@
// -*- rust -*-
// Tests for if as expressions with dynamic type sizes
-type compare = fn@(T, T) -> bool;
+type compare = @fn(T, T) -> bool;
fn test_generic(expected: T, not_expected: T, eq: compare) {
let actual: T = if true { expected } else { not_expected };
diff --git a/src/test/run-pass/fixed-point-bind-box.rs b/src/test/run-pass/fixed-point-bind-box.rs
index a1b41ca4b52..e28191ce35e 100644
--- a/src/test/run-pass/fixed-point-bind-box.rs
+++ b/src/test/run-pass/fixed-point-bind-box.rs
@@ -10,15 +10,15 @@
// xfail-fast
-fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B {
+fn fix_help(f: extern fn(@fn(A) -> B, A) -> B, x: A) -> B {
return f( |a| fix_help(f, a), x);
}
-fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
+fn fix(f: extern fn(@fn(A) -> B, A) -> B) -> @fn(A) -> B {
return |a| fix_help(f, a);
}
-fn fact_(f: fn@(v: int) -> int, n: int) -> int {
+fn fact_(f: @fn(v: int) -> int, n: int) -> int {
// fun fact 0 = 1
return if n == 0 { 1 } else { n * f(n - 1) };
}
diff --git a/src/test/run-pass/fixed-point-bind-unique.rs b/src/test/run-pass/fixed-point-bind-unique.rs
index dfd52940e73..0c34a94c982 100644
--- a/src/test/run-pass/fixed-point-bind-unique.rs
+++ b/src/test/run-pass/fixed-point-bind-unique.rs
@@ -10,15 +10,15 @@
// xfail-fast
-fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B {
+fn fix_help(f: extern fn(@fn(A) -> B, A) -> B, x: A) -> B {
return f(|a| fix_help(f, a), x);
}
-fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
+fn fix(f: extern fn(@fn(A) -> B, A) -> B) -> @fn(A) -> B {
return |a| fix_help(f, a);
}
-fn fact_(f: fn@(v: int) -> int, n: int) -> int {
+fn fact_(f: @fn(v: int) -> int, n: int) -> int {
// fun fact 0 = 1
return if n == 0 { 1 } else { n * f(n - 1) };
}
diff --git a/src/test/run-pass/fn-assign-managed-to-bare-1.rs b/src/test/run-pass/fn-assign-managed-to-bare-1.rs
index c08d8f61033..6facfc92d3e 100644
--- a/src/test/run-pass/fn-assign-managed-to-bare-1.rs
+++ b/src/test/run-pass/fn-assign-managed-to-bare-1.rs
@@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn add(n: int) -> fn@(int) -> int {
- fn@(m: int) -> int { m + n }
+fn add(n: int) -> @fn(int) -> int {
+ let result: @fn(int) -> int = |m| m + n;
+ result
}
-pub fn main()
-{
+pub fn main() {
assert add(3)(4) == 7;
let add3 : fn(int)->int = add(3);
assert add3(4) == 7;
diff --git a/src/test/run-pass/fn-assign-managed-to-bare-2.rs b/src/test/run-pass/fn-assign-managed-to-bare-2.rs
index 013b8ba4adb..be07da77baa 100644
--- a/src/test/run-pass/fn-assign-managed-to-bare-2.rs
+++ b/src/test/run-pass/fn-assign-managed-to-bare-2.rs
@@ -8,20 +8,21 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn add(n: int) -> fn@(int) -> int {
- fn@(m: int) -> int { m + n }
+fn add(n: int) -> @fn(int) -> int {
+ let result: @fn(int) -> int = |m| m + n;
+ result
}
pub fn main()
{
assert add(3)(4) == 7;
- let add1 : fn@(int)->int = add(1);
+ let add1 : @fn(int)->int = add(1);
assert add1(6) == 7;
- let add2 : &(fn@(int)->int) = &add(2);
+ let add2 : &(@fn(int)->int) = &add(2);
assert (*add2)(5) == 7;
- let add3 : fn(int)->int = add(3);
+ let add3 : &fn(int)->int = add(3);
assert add3(4) == 7;
}
diff --git a/src/test/run-pass/fn-bare-coerce-to-shared.rs b/src/test/run-pass/fn-bare-coerce-to-shared.rs
index 5f69af31134..853b44ed76c 100644
--- a/src/test/run-pass/fn-bare-coerce-to-shared.rs
+++ b/src/test/run-pass/fn-bare-coerce-to-shared.rs
@@ -10,7 +10,7 @@
fn bare() {}
-fn likes_shared(f: fn@()) { f() }
+fn likes_shared(f: @fn()) { f() }
pub fn main() {
likes_shared(bare);
diff --git a/src/test/run-pass/fn-coerce-field.rs b/src/test/run-pass/fn-coerce-field.rs
index d1c903411af..39e4f52873a 100644
--- a/src/test/run-pass/fn-coerce-field.rs
+++ b/src/test/run-pass/fn-coerce-field.rs
@@ -9,7 +9,7 @@
// except according to those terms.
struct r {
- field: fn@()
+ field: @fn()
}
pub fn main() {
diff --git a/src/test/run-pass/fn-type-infer.rs b/src/test/run-pass/fn-type-infer.rs
index 4fd78286e33..a753005069f 100644
--- a/src/test/run-pass/fn-type-infer.rs
+++ b/src/test/run-pass/fn-type-infer.rs
@@ -9,6 +9,8 @@
// except according to those terms.
pub fn main() {
- // We should be able to type infer inside of fn@s.
- let f = fn@() { let i = 10; };
+ // We should be able to type infer inside of @fns.
+ let f = || {
+ let i = 10;
+ };
}
diff --git a/src/test/run-pass/fun-call-variants.rs b/src/test/run-pass/fun-call-variants.rs
index 88bd1653861..b51f60f95a8 100644
--- a/src/test/run-pass/fun-call-variants.rs
+++ b/src/test/run-pass/fun-call-variants.rs
@@ -9,7 +9,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: @fn(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/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs
index b90633bab01..72d4ab7aeab 100644
--- a/src/test/run-pass/hashmap-memory.rs
+++ b/src/test/run-pass/hashmap-memory.rs
@@ -29,7 +29,7 @@ mod map_reduce {
use std::oldmap::HashMap;
use core::comm::*;
- pub type putter = fn@(~str, ~str);
+ pub type putter = @fn(~str, ~str);
pub type mapper = extern fn(~str, putter);
diff --git a/src/test/run-pass/infer-with-expected.rs b/src/test/run-pass/infer-with-expected.rs
index bbb094d0cad..723cc8ef633 100644
--- a/src/test/run-pass/infer-with-expected.rs
+++ b/src/test/run-pass/infer-with-expected.rs
@@ -13,7 +13,7 @@
// type must be known in this context' if the passing down doesn't
// happen.)
-fn eat_tup(_r: ~@(int, fn@(Pair) -> int)) {}
+fn eat_tup(_r: ~@(int, @fn(Pair) -> int)) {}
fn eat_rec(_r: @~Rec) {}
struct Rec { a: int, b: fn(Pair) -> int }
diff --git a/src/test/run-pass/issue-1516.rs b/src/test/run-pass/issue-1516.rs
index b277b880c76..33be716cc5f 100644
--- a/src/test/run-pass/issue-1516.rs
+++ b/src/test/run-pass/issue-1516.rs
@@ -9,5 +9,5 @@
// except according to those terms.
// xfail-test
-pub fn main() { let early_error: fn@(str) -> ! = {|msg| fail!() }; }
+pub fn main() { let early_error: @fn(str) -> ! = {|msg| fail!() }; }
diff --git a/src/test/run-pass/issue-1895.rs b/src/test/run-pass/issue-1895.rs
index 42c6ae38b6a..67877795cc0 100644
--- a/src/test/run-pass/issue-1895.rs
+++ b/src/test/run-pass/issue-1895.rs
@@ -10,8 +10,7 @@
pub fn main() {
let x = 1;
- let y = fn@() -> int {
- x
- }();
+ let y: @fn() -> int = || x;
+ let z = y();
}
diff --git a/src/test/run-pass/issue-1989.rs b/src/test/run-pass/issue-1989.rs
index 95129851d5b..e3327283a81 100644
--- a/src/test/run-pass/issue-1989.rs
+++ b/src/test/run-pass/issue-1989.rs
@@ -17,13 +17,13 @@ enum maybe_pointy {
struct Pointy {
a : maybe_pointy,
- f : fn@()->(),
+ f : @fn()->(),
}
fn empty_pointy() -> @mut Pointy {
return @mut Pointy{
a : none,
- f : fn@()->(){},
+ f : || {},
}
}
diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs
index a8533b574e8..cd2273ab173 100644
--- a/src/test/run-pass/issue-2185.rs
+++ b/src/test/run-pass/issue-2185.rs
@@ -18,21 +18,21 @@ trait iterable {
fn iter(blk: fn(A));
}
-impl iterable for fn@(fn(A)) {
+impl iterable for @fn(&fn(A)) {
fn iter(blk: fn(A)) { self(blk); }
}
-impl iterable for fn@(fn(uint)) {
+impl iterable for @fn(&fn(uint)) {
fn iter(blk: fn(&&v: uint)) { self( |i| blk(i) ) }
}
-fn filter>(self: IA, prd: fn@(A) -> bool, blk: fn(A)) {
+fn filter>(self: IA, prd: @fn(A) -> bool, blk: &fn(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: &fn(B, A) -> B) -> B {
let mut b = b0;
do self.iter |a| {
b = blk(b, a);
@@ -40,7 +40,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: &fn(uint)) {
let mut i = lo;
while i < hi {
it(i);
@@ -49,8 +49,8 @@ fn range(lo: uint, hi: uint, it: fn(uint)) {
}
pub fn main() {
- let range: fn@(fn&(uint)) = |a| range(0u, 1000u, a);
- let filt: fn@(fn&(v: uint)) = |a| filter(
+ let range: @fn(&fn(uint)) = |a| range(0u, 1000u, a);
+ let filt: @fn(&fn(v: uint)) = |a| filter(
range,
|&&n: uint| n % 3u != 0u && n % 5u != 0u,
a);
diff --git a/src/test/run-pass/issue-2190-1.rs b/src/test/run-pass/issue-2190-1.rs
index 82d4eea3af4..c769c33390f 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
const generations: uint = 1024+256+128+49;
-fn child_no(x: uint) -> fn~() {
+fn child_no(x: uint) -> ~fn() {
|| {
if x < generations {
task::spawn(child_no(x+1));
diff --git a/src/test/run-pass/issue-2190-2.rs b/src/test/run-pass/issue-2190-2.rs
index 245864cc339..3842e073faf 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
mod a {
-fn foo(f: fn&()) { f() }
+fn foo(f: &fn()) { f() }
fn bar() {}
pub fn main() { foo(||bar()); }
}
mod b {
-fn foo(f: Option) { f.iter(|x|x()) }
+fn foo(f: Option<&fn()>) { f.iter(|x|x()) }
fn bar() {}
pub fn main() { foo(Some(bar)); }
}
mod c {
-fn foo(f: Option) { f.iter(|x|x()) }
+fn foo(f: Option<&fn()>) { f.iter(|x|x()) }
fn bar() {}
pub fn main() { foo(Some(||bar())); }
}
diff --git a/src/test/run-pass/issue-2190.rs b/src/test/run-pass/issue-2190.rs
index 2e956e0be5e..05869952fb8 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: ~fn()
};
pub fn main() {
diff --git a/src/test/run-pass/issue-2633.rs b/src/test/run-pass/issue-2633.rs
index 04d75fd08e1..2eb63102224 100644
--- a/src/test/run-pass/issue-2633.rs
+++ b/src/test/run-pass/issue-2633.rs
@@ -9,12 +9,12 @@
// except according to those terms.
struct cat {
- meow: fn@(),
+ meow: @fn(),
}
fn cat() -> cat {
cat {
- meow: fn@() { error!("meow"); }
+ meow: || error!("meow")
}
}
diff --git a/src/test/run-pass/issue-3052.rs b/src/test/run-pass/issue-3052.rs
index f01ef370e2a..852c6d995c6 100644
--- a/src/test/run-pass/issue-3052.rs
+++ b/src/test/run-pass/issue-3052.rs
@@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-type Connection = fn@(~[u8]);
+type Connection = @fn(~[u8]);
fn f() -> Option {
- let mock_connection: Connection = fn@(_data: ~[u8]) { };
+ let mock_connection: Connection = |_| {};
Some(mock_connection)
}
diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs
index e4649ed0470..0e4f7d9749d 100644
--- a/src/test/run-pass/issue-3424.rs
+++ b/src/test/run-pass/issue-3424.rs
@@ -14,7 +14,7 @@
extern mod std;
use core::path::{Path};
-type rsrc_loader = fn~ (path: &Path) -> result::Result<~str, ~str>;
+type rsrc_loader = ~fn(path: &Path) -> result::Result<~str, ~str>;
#[test]
fn tester()
diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs
index cc774e21376..d0afd0107ee 100644
--- a/src/test/run-pass/issue-3609.rs
+++ b/src/test/run-pass/issue-3609.rs
@@ -3,7 +3,7 @@ extern mod std;
use core::comm::Chan;
type RingBuffer = ~[float];
-type SamplesFn = fn~ (samples: &RingBuffer);
+type SamplesFn = ~fn(samples: &RingBuffer);
enum Msg
{
diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs
index b68ec3755d5..a1f57b380c1 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 @fn.
struct Refs { refs: ~[int], n: int }
pub fn main() {
let e = @mut Refs{refs: ~[], n: 0};
- let f = fn@ () { log(error, e.n); };
+ let f: @fn() = || log(error, e.n);
e.refs += ~[1];
}
diff --git a/src/test/run-pass/lambda-no-leak.rs b/src/test/run-pass/lambda-no-leak.rs
index 9868f026c65..2dc7079af53 100644
--- a/src/test/run-pass/lambda-no-leak.rs
+++ b/src/test/run-pass/lambda-no-leak.rs
@@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// Make sure we don't leak fn@s in silly ways.
-fn force(f: fn@()) { f() }
+// Make sure we don't leak @fns in silly ways.
+fn force(f: @fn()) { f() }
pub fn main() {
let x = 7;
- let _f = fn@() { log(error, x); };
- force(fn@() { log(error, x); });
+ let _f: @fn() = || log(error, x);
+ force(|| log(error, x));
}
diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs
index 2fd2cc9d22b..b5fb4368098 100644
--- a/src/test/run-pass/last-use-in-cap-clause.rs
+++ b/src/test/run-pass/last-use-in-cap-clause.rs
@@ -12,10 +12,11 @@
struct A { a: ~int }
-fn foo() -> fn@() -> int {
+fn foo() -> @fn() -> int {
let k = ~22;
let _u = A {a: copy k};
- return fn@() -> int { 22 };
+ let result: @fn() -> int = || 22;
+ result
}
pub fn main() {
diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs
index 7f4551b9f39..0535e63fcb4 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: @fn()) { f(); }
let k = ~22;
let _u = A {a: copy k};
invoke(|| log(error, copy k) )
diff --git a/src/test/run-pass/monomorphize-trait-in-fn-at.rs b/src/test/run-pass/monomorphize-trait-in-fn-at.rs
index 3c491a7f695..ee9af0d9d6c 100644
--- a/src/test/run-pass/monomorphize-trait-in-fn-at.rs
+++ b/src/test/run-pass/monomorphize-trait-in-fn-at.rs
@@ -9,7 +9,7 @@
// except according to those terms.
// test that invoking functions which require
-// dictionaries from inside an fn@ works
+// dictionaries from inside an @fn works
// (at one point, it didn't)
fn mk_nil(cx: C) -> uint {
@@ -25,8 +25,6 @@ impl ty_ops for () {
}
pub fn main() {
- let fn_env = fn@() -> uint {
- mk_nil(())
- };
+ let fn_env: @fn() -> uint = || mk_nil(());
assert fn_env() == 22u;
}
diff --git a/src/test/run-pass/move-nullary-fn.rs b/src/test/run-pass/move-nullary-fn.rs
index 0114eeefbfb..48f4a75ed4e 100644
--- a/src/test/run-pass/move-nullary-fn.rs
+++ b/src/test/run-pass/move-nullary-fn.rs
@@ -9,12 +9,12 @@
// except according to those terms.
// Issue #922
-fn f2(-thing: fn@()) { }
+fn f2(-thing: @fn()) { }
-fn f(-thing: fn@()) {
+fn f(-thing: @fn()) {
f2(thing);
}
pub fn main() {
- f(fn@() {});
+ f(|| {});
}
diff --git a/src/test/run-pass/newlambdas-ret-infer.rs b/src/test/run-pass/newlambdas-ret-infer.rs
index 0838ae83cb5..10ac45922aa 100644
--- a/src/test/run-pass/newlambdas-ret-infer.rs
+++ b/src/test/run-pass/newlambdas-ret-infer.rs
@@ -11,9 +11,9 @@
// Test that the lambda kind is inferred correctly as a return
// expression
-fn shared() -> fn@() { return || (); }
+fn shared() -> @fn() { return || (); }
-fn unique() -> fn~() { return || (); }
+fn unique() -> ~fn() { 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 4a4be9859d1..4b580e7fa79 100644
--- a/src/test/run-pass/newlambdas-ret-infer2.rs
+++ b/src/test/run-pass/newlambdas-ret-infer2.rs
@@ -8,13 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// xfail-test fn~ is not inferred
+// xfail-test ~fn is not inferred
// Test that the lambda kind is inferred correctly as a return
// expression
-fn shared() -> fn@() { || () }
+fn shared() -> @fn() { || () }
-fn unique() -> fn~() { || () }
+fn unique() -> ~fn() { || () }
pub fn main() {
}
diff --git a/src/test/run-pass/newlambdas.rs b/src/test/run-pass/newlambdas.rs
index c47ee5098a5..21a3e350689 100644
--- a/src/test/run-pass/newlambdas.rs
+++ b/src/test/run-pass/newlambdas.rs
@@ -10,11 +10,11 @@
// Tests for the new |args| expr lambda syntax
-fn f(i: int, f: fn(int) -> int) -> int { f(i) }
+fn f(i: int, f: &fn(int) -> int) -> int { f(i) }
fn g(g: fn()) { }
-fn ff() -> fn@(int) -> int {
+fn ff() -> @fn(int) -> int {
return |x| x + 1;
}
@@ -23,7 +23,7 @@ pub fn main() {
g(||());
assert do f(10) |a| { a } == 10;
do g() { }
- let _x: fn@() -> int = || 10;
- let _y: fn@(int) -> int = |a| a;
+ let _x: @fn() -> int = || 10;
+ let _y: @fn(int) -> int = |a| a;
assert ff()(10) == 11;
}
diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs
index c9e8c6f4b14..8c3423bf844 100644
--- a/src/test/run-pass/operator-overloading.rs
+++ b/src/test/run-pass/operator-overloading.rs
@@ -66,5 +66,6 @@ pub fn main() {
assert q.y == !(p.y);
// Issue #1733
- fn~(_x: int){}(p[true]);
+ let result: ~fn(int) = |_|();
+ result(p[true]);
}
diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs
index 541d898c1ff..852c580667a 100644
--- a/src/test/run-pass/reflect-visit-data.rs
+++ b/src/test/run-pass/reflect-visit-data.rs
@@ -463,9 +463,9 @@ impl TyVisitor for ptr_visit_adaptor {
}
fn visit_closure_ptr(&self, ck: uint) -> bool {
- self.align_to::();
+ self.align_to::<@fn()>();
if ! self.inner.visit_closure_ptr(ck) { return false; }
- self.bump_past::();
+ self.bump_past::<@fn()>();
true
}
}
diff --git a/src/test/run-pass/regions-equiv-fns.rs b/src/test/run-pass/regions-equiv-fns.rs
index fb68e3e2b08..e78a6e69bdd 100644
--- a/src/test/run-pass/regions-equiv-fns.rs
+++ b/src/test/run-pass/regions-equiv-fns.rs
@@ -13,7 +13,7 @@
fn ok(a: &uint) {
// Here &r is an alias for &:
- let mut g: fn@(x: &uint) = fn@(x: &r/uint) {};
+ let mut g: @fn(x: &uint) = |x: &r/uint| {};
g(a);
}
diff --git a/src/test/run-pass/regions-fn-subtyping.rs b/src/test/run-pass/regions-fn-subtyping.rs
index 2ed0d499e18..b28d8534fec 100644
--- a/src/test/run-pass/regions-fn-subtyping.rs
+++ b/src/test/run-pass/regions-fn-subtyping.rs
@@ -11,21 +11,21 @@
// Issue #2263.
// Should pass region checking.
-fn ok(f: fn@(x: &uint)) {
+fn ok(f: @fn(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@(y: &r/uint) = fn@(x: &r/uint) { };
+ let mut g: @fn(y: &r/uint) = |x: &r/uint| { };
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@(x: &r/uint) { };
+fn ok_inferred(f: @fn(x: &uint)) {
+ let mut g: @fn(x: &r/uint) = |_| {};
g = f;
}
diff --git a/src/test/run-pass/rt-sched-1.rs b/src/test/run-pass/rt-sched-1.rs
index ca37a6663fd..ce4e6218d0b 100644
--- a/src/test/run-pass/rt-sched-1.rs
+++ b/src/test/run-pass/rt-sched-1.rs
@@ -35,7 +35,7 @@ pub fn main() {
error!("new_sched_id %?", new_sched_id);
let new_task_id = rustrt::rust_new_task_in_sched(new_sched_id);
assert !new_task_id.is_null();
- let f = fn~() {
+ let f: ~fn() = || {
unsafe {
let child_sched_id = rustrt::rust_get_sched_id();
error!("child_sched_id %?", child_sched_id);
diff --git a/src/test/run-pass/sendfn-generic-fn.rs b/src/test/run-pass/sendfn-generic-fn.rs
index 8ae976ccade..c0af726dd8d 100644
--- a/src/test/run-pass/sendfn-generic-fn.rs
+++ b/src/test/run-pass/sendfn-generic-fn.rs
@@ -31,10 +31,8 @@ fn test05_start(f: &~fn(v: float, v: ~str) -> Pair) {
}
fn spawn(f: extern fn(&~fn(A,B)->Pair)) {
- let arg = fn~(a: A, b: B) -> Pair {
- return make_generic_record(a, b);
- };
- task::spawn(|| f(&arg) );
+ let arg: ~fn(A, B) -> Pair = |a, b| make_generic_record(a, b);
+ task::spawn(|| f(&arg));
}
fn test05() {
diff --git a/src/test/run-pass/sendfn-is-a-block.rs b/src/test/run-pass/sendfn-is-a-block.rs
index 099ba326300..92e709a3738 100644
--- a/src/test/run-pass/sendfn-is-a-block.rs
+++ b/src/test/run-pass/sendfn-is-a-block.rs
@@ -15,6 +15,6 @@ fn test(f: fn(uint) -> uint) -> uint {
}
pub fn main() {
- let y = test(fn~(x: uint) -> uint { return 4u * x; });
+ let y = test(|x| 4u * x);
assert y == 88u;
}
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 fce0889e0a9..9b71f678122 100644
--- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs
+++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs
@@ -10,17 +10,17 @@
pub fn main() { test05(); }
-fn test05_start(&&f: fn~(int)) {
+fn test05_start(&&f: ~fn(int)) {
f(22);
}
fn test05() {
let three = ~3;
- let fn_to_send = fn~(n: int) {
+ let fn_to_send: ~fn(int) = |n| {
log(error, *three + n); // will copy x into the closure
assert(*three == 3);
};
- task::spawn(fn~() {
+ task::spawn(|| {
test05_start(fn_to_send);
});
}
diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs
index 991025a1ad2..48a2b302098 100644
--- a/src/test/run-pass/task-killjoin-rsrc.rs
+++ b/src/test/run-pass/task-killjoin-rsrc.rs
@@ -39,7 +39,7 @@ fn notify(ch: Chan, v: @mut bool) -> notify {
}
}
-fn joinable(f: fn~()) -> Port {
+fn joinable(f: ~fn()) -> Port {
fn wrapper(c: Chan, f: fn()) {
let b = @mut false;
error!("wrapper: task=%? allocated v=%x",
diff --git a/src/test/run-pass/task-spawn-move-and-copy.rs b/src/test/run-pass/task-spawn-move-and-copy.rs
index 805f8e8b1e2..cbfff832736 100644
--- a/src/test/run-pass/task-spawn-move-and-copy.rs
+++ b/src/test/run-pass/task-spawn-move-and-copy.rs
@@ -16,7 +16,7 @@ pub fn main() {
let x = ~1;
let x_in_parent = ptr::addr_of(&(*x)) as uint;
- task::spawn(fn~() {
+ task::spawn(|| {
let x_in_child = ptr::addr_of(&(*x)) as uint;
ch.send(x_in_child);
});
diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs
index def49ef0f8c..3a23a8246a5 100644
--- a/src/test/run-pass/uniq-cc-generic.rs
+++ b/src/test/run-pass/uniq-cc-generic.rs
@@ -15,11 +15,12 @@ enum maybe_pointy {
struct Pointy {
a : maybe_pointy,
- d : fn~() -> uint,
+ d : ~fn() -> uint,
}
-fn make_uniq_closure(a: A) -> fn~() -> uint {
- fn~() -> uint { ptr::addr_of(&a) as uint }
+fn make_uniq_closure(a: A) -> ~fn() -> uint {
+ let result: ~fn() -> uint = || ptr::addr_of(&a) as uint;
+ result
}
fn empty_pointy() -> @mut Pointy {
diff --git a/src/test/run-pass/uniq-cc.rs b/src/test/run-pass/uniq-cc.rs
index 3d72a411828..b54daa477ec 100644
--- a/src/test/run-pass/uniq-cc.rs
+++ b/src/test/run-pass/uniq-cc.rs
@@ -16,14 +16,14 @@ enum maybe_pointy {
struct Pointy {
a : maybe_pointy,
c : ~int,
- d : fn~()->(),
+ d : ~fn()->(),
}
fn empty_pointy() -> @mut Pointy {
return @mut Pointy {
a : none,
c : ~22,
- d : fn~()->(){},
+ d : || {},
}
}
diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs
index 665abe23ee8..62023fdae53 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: @fn() = || {};
lam_move();
}