about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2015-01-02 17:32:54 -0500
committerJorge Aparicio <japaricious@gmail.com>2015-01-05 17:22:16 -0500
commitca17d0812686012307e364a4dce7b84af6886f91 (patch)
tree842b973e6d84b928431910cda850eec90992bd96
parent8d0d7521d65eff290183e9d19858c6ca8779fe01 (diff)
downloadrust-ca17d0812686012307e364a4dce7b84af6886f91.tar.gz
rust-ca17d0812686012307e364a4dce7b84af6886f91.zip
fix rpass tests
-rw-r--r--src/test/auxiliary/cci_impl_lib.rs4
-rw-r--r--src/test/auxiliary/cci_iter_lib.rs2
-rw-r--r--src/test/auxiliary/cci_no_inline_lib.rs2
-rw-r--r--src/test/auxiliary/iss.rs8
-rw-r--r--src/test/auxiliary/issue13507.rs4
-rw-r--r--src/test/auxiliary/logging_right_crate.rs2
-rw-r--r--src/test/run-pass/argument-passing.rs2
-rw-r--r--src/test/run-pass/autobind.rs4
-rw-r--r--src/test/run-pass/block-arg-call-as.rs2
-rw-r--r--src/test/run-pass/block-explicit-types.rs2
-rw-r--r--src/test/run-pass/block-fn-coerce.rs5
-rw-r--r--src/test/run-pass/block-iter-1.rs2
-rw-r--r--src/test/run-pass/block-iter-2.rs2
-rw-r--r--src/test/run-pass/borrowck-borrow-from-expr-block.rs2
-rw-r--r--src/test/run-pass/borrowck-closures-two-imm.rs14
-rw-r--r--src/test/run-pass/borrowck-mut-uniq.rs2
-rw-r--r--src/test/run-pass/call-closure-from-overloaded-op.rs1
-rw-r--r--src/test/run-pass/capture-clauses-boxed-closures.rs2
-rw-r--r--src/test/run-pass/closure-inference.rs4
-rw-r--r--src/test/run-pass/closure-inference2.rs2
-rw-r--r--src/test/run-pass/closure-reform.rs25
-rw-r--r--src/test/run-pass/closure-return-bang.rs20
-rw-r--r--src/test/run-pass/closure-syntax.rs79
-rw-r--r--src/test/run-pass/coerce-to-closure-and-proc.rs37
-rw-r--r--src/test/run-pass/const-fn-val.rs4
-rw-r--r--src/test/run-pass/const-vec-of-fns.rs4
-rw-r--r--src/test/run-pass/empty-tag.rs2
-rw-r--r--src/test/run-pass/enum-null-pointer-opt.rs3
-rw-r--r--src/test/run-pass/expr-block-fn.rs3
-rw-r--r--src/test/run-pass/expr-block-generic-unique1.rs9
-rw-r--r--src/test/run-pass/expr-block-generic-unique2.rs9
-rw-r--r--src/test/run-pass/expr-block-generic.rs13
-rw-r--r--src/test/run-pass/expr-if-generic.rs15
-rw-r--r--src/test/run-pass/expr-match-generic-unique1.rs9
-rw-r--r--src/test/run-pass/expr-match-generic-unique2.rs9
-rw-r--r--src/test/run-pass/fn-bare-coerce-to-block.rs2
-rw-r--r--src/test/run-pass/fn-coerce-field.rs6
-rw-r--r--src/test/run-pass/fn-pattern-expected-type.rs2
-rw-r--r--src/test/run-pass/fn-type-infer.rs2
-rw-r--r--src/test/run-pass/foreach-nested.rs2
-rw-r--r--src/test/run-pass/foreach-put-structured.rs2
-rw-r--r--src/test/run-pass/foreach-simple-outer-slot.rs2
-rw-r--r--src/test/run-pass/fun-call-variants.rs2
-rw-r--r--src/test/run-pass/generic-static-methods.rs4
-rw-r--r--src/test/run-pass/hashmap-memory.rs10
-rw-r--r--src/test/run-pass/hrtb-debruijn-object-types-in-closures.rs3
-rw-r--r--src/test/run-pass/hrtb-parse.rs3
-rw-r--r--src/test/run-pass/hrtb-trait-object-passed-to-closure.rs2
-rw-r--r--src/test/run-pass/issue-13434.rs4
-rw-r--r--src/test/run-pass/issue-13507-2.rs1
-rw-r--r--src/test/run-pass/issue-13808.rs6
-rw-r--r--src/test/run-pass/issue-1460.rs2
-rw-r--r--src/test/run-pass/issue-14919.rs8
-rw-r--r--src/test/run-pass/issue-1516.rs13
-rw-r--r--src/test/run-pass/issue-16256.rs2
-rw-r--r--src/test/run-pass/issue-2074.rs4
-rw-r--r--src/test/run-pass/issue-2487-a.rs2
-rw-r--r--src/test/run-pass/issue-3052.rs4
-rw-r--r--src/test/run-pass/issue-3429.rs4
-rw-r--r--src/test/run-pass/issue-3874.rs2
-rw-r--r--src/test/run-pass/issue-3904.rs10
-rw-r--r--src/test/run-pass/issue-5239-2.rs2
-rw-r--r--src/test/run-pass/issue-6153.rs2
-rw-r--r--src/test/run-pass/issue-6157.rs6
-rw-r--r--src/test/run-pass/issue-868.rs4
-rw-r--r--src/test/run-pass/issue-9129.rs2
-rw-r--r--src/test/run-pass/iter-range.rs2
-rw-r--r--src/test/run-pass/lambda-infer-unresolved.rs2
-rw-r--r--src/test/run-pass/last-use-in-block.rs6
-rw-r--r--src/test/run-pass/last-use-in-cap-clause.rs9
-rw-r--r--src/test/run-pass/last-use-is-capture.rs2
-rw-r--r--src/test/run-pass/match-phi.rs2
-rw-r--r--src/test/run-pass/monad.rs8
-rw-r--r--src/test/run-pass/move-nullary-fn.rs4
-rw-r--r--src/test/run-pass/mut-function-arguments.rs2
-rw-r--r--src/test/run-pass/mut-in-ident-patterns.rs2
-rw-r--r--src/test/run-pass/newlambdas.rs4
-rw-r--r--src/test/run-pass/non-legacy-modes.rs2
-rw-r--r--src/test/run-pass/pattern-in-closure.rs4
-rw-r--r--src/test/run-pass/purity-infer.rs2
-rw-r--r--src/test/run-pass/regions-copy-closure.rs12
-rw-r--r--src/test/run-pass/regions-dependent-autofn.rs4
-rw-r--r--src/test/run-pass/regions-fn-subtyping-2.rs4
-rw-r--r--src/test/run-pass/regions-fn-subtyping.rs8
-rw-r--r--src/test/run-pass/regions-infer-call-2.rs2
-rw-r--r--src/test/run-pass/regions-lifetime-nonfree-late-bound.rs8
-rw-r--r--src/test/run-pass/regions-link-fn-args.rs2
-rw-r--r--src/test/run-pass/regions-params.rs2
-rw-r--r--src/test/run-pass/regions-static-closure.rs12
-rw-r--r--src/test/run-pass/return-from-closure.rs2
-rw-r--r--src/test/run-pass/sendfn-is-a-block.rs2
-rw-r--r--src/test/run-pass/static-impl.rs14
-rw-r--r--src/test/run-pass/struct-partial-move-1.rs2
-rw-r--r--src/test/run-pass/struct-partial-move-2.rs2
-rw-r--r--src/test/run-pass/tempfile.rs2
-rw-r--r--src/test/run-pass/trait-bounds-in-arc.rs14
-rw-r--r--src/test/run-pass/trait-generic.rs4
-rw-r--r--src/test/run-pass/type-id-higher-rank.rs18
-rw-r--r--src/test/run-pass/type-params-in-for-each.rs2
-rw-r--r--src/test/run-pass/unnamed_argument_mode.rs2
-rw-r--r--src/test/run-pass/unused-move-capture.rs2
-rw-r--r--src/test/run-pass/variadic-ffi.rs2
-rw-r--r--src/test/run-pass/vec-matching-fold.rs22
-rw-r--r--src/test/run-pass/weird-exprs.rs2
104 files changed, 212 insertions, 414 deletions
diff --git a/src/test/auxiliary/cci_impl_lib.rs b/src/test/auxiliary/cci_impl_lib.rs
index 40a9a52061f..3b1857f9ccb 100644
--- a/src/test/auxiliary/cci_impl_lib.rs
+++ b/src/test/auxiliary/cci_impl_lib.rs
@@ -11,12 +11,12 @@
 #![crate_name="cci_impl_lib"]
 
 pub trait uint_helpers {
-    fn to(&self, v: uint, f: |uint|);
+    fn to<F>(&self, v: uint, f: F) where F: FnMut(uint);
 }
 
 impl uint_helpers for uint {
     #[inline]
-    fn to(&self, v: uint, f: |uint|) {
+    fn to<F>(&self, v: uint, mut f: F) where F: FnMut(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 84ade3572f9..3ba068df058 100644
--- a/src/test/auxiliary/cci_iter_lib.rs
+++ b/src/test/auxiliary/cci_iter_lib.rs
@@ -11,7 +11,7 @@
 #![crate_name="cci_iter_lib"]
 
 #[inline]
-pub fn iter<T>(v: &[T], f: |&T|) {
+pub fn iter<T, F>(v: &[T], mut f: F) where F: FnMut(&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 67f55cca1e1..474925d8838 100644
--- a/src/test/auxiliary/cci_no_inline_lib.rs
+++ b/src/test/auxiliary/cci_no_inline_lib.rs
@@ -12,7 +12,7 @@
 
 
 // same as cci_iter_lib, more-or-less, but not marked inline
-pub fn iter(v: Vec<uint> , f: |uint|) {
+pub fn iter<F>(v: Vec<uint> , mut f: F) where F: FnMut(uint) {
     let mut i = 0u;
     let n = v.len();
     while i < n {
diff --git a/src/test/auxiliary/iss.rs b/src/test/auxiliary/iss.rs
index 37edcdf7628..690d5783c4b 100644
--- a/src/test/auxiliary/iss.rs
+++ b/src/test/auxiliary/iss.rs
@@ -12,12 +12,12 @@
 
 // part of issue-6919.rs
 
-pub struct C<'a> {
-    pub k: ||: 'a,
+pub struct C<K> where K: FnOnce() {
+    pub k: K,
 }
 
 fn no_op() { }
-pub const D : C<'static> = C {
-    k: no_op
+pub const D : C<fn()> = C {
+    k: no_op as fn()
 };
 
diff --git a/src/test/auxiliary/issue13507.rs b/src/test/auxiliary/issue13507.rs
index 961dad00091..c2820a8d4ae 100644
--- a/src/test/auxiliary/issue13507.rs
+++ b/src/test/auxiliary/issue13507.rs
@@ -21,7 +21,6 @@ pub mod testtypes {
         ids.push(TypeId::of::<FooEnum>());
         ids.push(TypeId::of::<FooUniq>());
         ids.push(TypeId::of::<FooPtr>());
-        ids.push(TypeId::of::<FooClosure>());
         ids.push(TypeId::of::<&'static FooTrait>());
         ids.push(TypeId::of::<FooStruct>());
         ids.push(TypeId::of::<FooTuple>());
@@ -68,9 +67,6 @@ pub mod testtypes {
 
     // Skipping ty_bare_fn (how do you get a bare function type, rather than proc or closure?)
 
-    // Tests ty_closure (does not test all types of closures)
-    pub type FooClosure = |arg: u8|: 'static -> u8;
-
     // Tests ty_trait
     pub trait FooTrait {
         fn foo_method(&self) -> uint;
diff --git a/src/test/auxiliary/logging_right_crate.rs b/src/test/auxiliary/logging_right_crate.rs
index fad70a91798..399dfb9fa9a 100644
--- a/src/test/auxiliary/logging_right_crate.rs
+++ b/src/test/auxiliary/logging_right_crate.rs
@@ -13,5 +13,5 @@
 
 pub fn foo<T>() {
     fn death() -> int { panic!() }
-    debug!("{}", (||{ death() })());
+    debug!("{}", (|&:|{ death() })());
 }
diff --git a/src/test/run-pass/argument-passing.rs b/src/test/run-pass/argument-passing.rs
index 75e197923c6..dfce3115290 100644
--- a/src/test/run-pass/argument-passing.rs
+++ b/src/test/run-pass/argument-passing.rs
@@ -20,7 +20,7 @@ fn f1(a: &mut X, b: &mut int, c: int) -> int {
     return r;
 }
 
-fn f2(a: int, f: |int|) -> int { f(1); return a; }
+fn f2<F>(a: int, f: F) -> int where F: FnOnce(int) { f(1); return a; }
 
 pub fn main() {
     let mut a = X {x: 1};
diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs
index f5766ae1e53..ed471ed0079 100644
--- a/src/test/run-pass/autobind.rs
+++ b/src/test/run-pass/autobind.rs
@@ -11,11 +11,11 @@
 
 fn f<T>(x: Vec<T>) -> T { return x.into_iter().next().unwrap(); }
 
-fn g(act: |Vec<int> | -> int) -> int { return act(vec!(1, 2, 3)); }
+fn g<F>(act: F) -> int where F: FnOnce(Vec<int>) -> int { return act(vec!(1, 2, 3)); }
 
 pub fn main() {
     assert_eq!(g(f), 1);
-    let f1: |Vec<String>| -> String = f;
+    let f1 = f;
     assert_eq!(f1(vec!["x".to_string(), "y".to_string(), "z".to_string()]),
                "x".to_string());
 }
diff --git a/src/test/run-pass/block-arg-call-as.rs b/src/test/run-pass/block-arg-call-as.rs
index b4e36629651..6c54f33fbe6 100644
--- a/src/test/run-pass/block-arg-call-as.rs
+++ b/src/test/run-pass/block-arg-call-as.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn asBlock(f: || -> uint) -> uint {
+fn asBlock<F>(f: F) -> uint where F: FnOnce() -> uint {
    return f();
 }
 
diff --git a/src/test/run-pass/block-explicit-types.rs b/src/test/run-pass/block-explicit-types.rs
index 63051d71271..54b650d762b 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<T>(s: String, f: |String| -> T) -> T { f(s) }
+    fn as_buf<T, F>(s: String, f: F) -> T where F: FnOnce(String) -> T { f(s) }
     as_buf("foo".to_string(), |foo: String| -> () println!("{}", foo) );
 }
diff --git a/src/test/run-pass/block-fn-coerce.rs b/src/test/run-pass/block-fn-coerce.rs
index bbb30e9578e..fe52b1a693c 100644
--- a/src/test/run-pass/block-fn-coerce.rs
+++ b/src/test/run-pass/block-fn-coerce.rs
@@ -8,10 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn force(f: || -> int) -> int { return f(); }
+fn force<F>(f: F) -> int where F: FnOnce() -> int { return f(); }
+
 pub fn main() {
     fn f() -> int { return 7; }
     assert_eq!(force(f), 7);
-    let g = {||force(f)};
+    let g = {|&:|force(f)};
     assert_eq!(g(), 7);
 }
diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs
index ce20c3024d6..972bde5f29a 100644
--- a/src/test/run-pass/block-iter-1.rs
+++ b/src/test/run-pass/block-iter-1.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn iter_vec<T>(v: Vec<T> , f: |&T|) { for x in v.iter() { f(x); } }
+fn iter_vec<T, F>(v: Vec<T> , mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } }
 
 pub fn main() {
     let v = vec!(1i, 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 7bb9d0ddf99..1032fb486a1 100644
--- a/src/test/run-pass/block-iter-2.rs
+++ b/src/test/run-pass/block-iter-2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn iter_vec<T>(v: Vec<T> , f: |&T|) { for x in v.iter() { f(x); } }
+fn iter_vec<T, F>(v: Vec<T>, mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } }
 
 pub fn main() {
     let v = vec!(1i, 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 8c4995e7100..038f9e5c9ab 100644
--- a/src/test/run-pass/borrowck-borrow-from-expr-block.rs
+++ b/src/test/run-pass/borrowck-borrow-from-expr-block.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-fn borrow(x: &int, f: |x: &int|) {
+fn borrow<F>(x: &int, f: F) where F: FnOnce(&int) {
     f(x)
 }
 
diff --git a/src/test/run-pass/borrowck-closures-two-imm.rs b/src/test/run-pass/borrowck-closures-two-imm.rs
index 3bd12b03041..33e4294366f 100644
--- a/src/test/run-pass/borrowck-closures-two-imm.rs
+++ b/src/test/run-pass/borrowck-closures-two-imm.rs
@@ -15,10 +15,10 @@
 // the closures are in scope. Issue #6801.
 
 fn a() -> int {
-    let mut x = 3;
+    let mut x = 3i;
     x += 1;
-    let c1 = || x * 4;
-    let c2 = || x * 5;
+    let c1 = |&:| x * 4;
+    let c2 = |&:| x * 5;
     c1() * c2() * x
 }
 
@@ -29,16 +29,16 @@ fn get(x: &int) -> int {
 fn b() -> int {
     let mut x = 3;
     x += 1;
-    let c1 = || get(&x);
-    let c2 = || get(&x);
+    let c1 = |&:| get(&x);
+    let c2 = |&:| get(&x);
     c1() * c2() * x
 }
 
 fn c() -> int {
     let mut x = 3;
     x += 1;
-    let c1 = || x * 5;
-    let c2 = || get(&x);
+    let c1 = |&:| x * 5;
+    let c2 = |&:| get(&x);
     c1() * c2() * x
 }
 
diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs
index 176c7277efd..dac8945b6e8 100644
--- a/src/test/run-pass/borrowck-mut-uniq.rs
+++ b/src/test/run-pass/borrowck-mut-uniq.rs
@@ -21,7 +21,7 @@ fn add_int(x: &mut Ints, v: int) {
     swap(&mut values, &mut x.values);
 }
 
-fn iter_ints(x: &Ints, f: |x: &int| -> bool) -> bool {
+fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool {
     let l = x.values.len();
     range(0u, l).all(|i| f(&x.values[i]))
 }
diff --git a/src/test/run-pass/call-closure-from-overloaded-op.rs b/src/test/run-pass/call-closure-from-overloaded-op.rs
index 432d022c69b..032bb83d3ab 100644
--- a/src/test/run-pass/call-closure-from-overloaded-op.rs
+++ b/src/test/run-pass/call-closure-from-overloaded-op.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(japaric) this ICEs
 
 fn foo() -> int { 22 }
 
diff --git a/src/test/run-pass/capture-clauses-boxed-closures.rs b/src/test/run-pass/capture-clauses-boxed-closures.rs
index d24b9332917..6e8ed4fd5a1 100644
--- a/src/test/run-pass/capture-clauses-boxed-closures.rs
+++ b/src/test/run-pass/capture-clauses-boxed-closures.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn each<T>(x: &[T], f: |&T|) {
+fn each<T, F>(x: &[T], mut f: F) where F: FnMut(&T) {
     for val in x.iter() {
         f(val)
     }
diff --git a/src/test/run-pass/closure-inference.rs b/src/test/run-pass/closure-inference.rs
index 410b7416546..893003dd997 100644
--- a/src/test/run-pass/closure-inference.rs
+++ b/src/test/run-pass/closure-inference.rs
@@ -11,9 +11,9 @@
 
 fn foo(i: int) -> int { i + 1 }
 
-fn apply<A>(f: |A| -> A, v: A) -> A { f(v) }
+fn apply<A, F>(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) }
 
 pub fn main() {
-    let f = {|i| foo(i)};
+    let f = {|: i| foo(i)};
     assert_eq!(apply(f, 2), 3);
 }
diff --git a/src/test/run-pass/closure-inference2.rs b/src/test/run-pass/closure-inference2.rs
index 6666b8e3cfa..03b10b881f7 100644
--- a/src/test/run-pass/closure-inference2.rs
+++ b/src/test/run-pass/closure-inference2.rs
@@ -11,7 +11,7 @@
 // Test a rather underspecified example:
 
 pub fn main() {
-    let f = {|i| i};
+    let f = {|&: i| i};
     assert_eq!(f(2i), 2i);
     assert_eq!(f(5i), 5i);
 }
diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs
index 03d9511b41c..a2e7d7bd7e3 100644
--- a/src/test/run-pass/closure-reform.rs
+++ b/src/test/run-pass/closure-reform.rs
@@ -22,25 +22,14 @@ fn call_it<F>(f: F)
     println!("{}", f("Fred".to_string()))
 }
 
-fn call_a_thunk(f: ||) {
+fn call_a_thunk<F>(f: F) where F: FnOnce() {
     f();
 }
 
-fn call_this(f: |&str|:Send) {
+fn call_this<F>(f: F) where F: FnOnce(&str) + Send {
     f("Hello!");
 }
 
-fn call_that(f: <'a>|&'a int, &'a int| -> int) {
-    let (ten, forty_two) = (10, 42);
-    println!("Your lucky number is {}", f(&ten, &forty_two));
-}
-
-fn call_cramped(f:||->uint,g:<'a>||->&'a uint) {
-    let number = f();
-    let other_number = *g();
-    println!("Ticket {} wins an all-expenses-paid trip to Mountain View", number + other_number);
-}
-
 fn call_bare(f: fn(&str)) {
     f("Hello world!")
 }
@@ -71,16 +60,6 @@ pub fn main() {
 
     call_this(|s| println!("{}", s));
 
-    call_that(|x, y| *x + *y);
-
-    let z = 100;
-    call_that(|x, y| *x + *y - z);
-
-    call_cramped(|| 1, || unsafe {
-        static a: uint = 100;
-        mem::transmute(&a)
-    });
-
     // External functions
 
     call_bare(println);
diff --git a/src/test/run-pass/closure-return-bang.rs b/src/test/run-pass/closure-return-bang.rs
deleted file mode 100644
index 9b4033ae0d7..00000000000
--- a/src/test/run-pass/closure-return-bang.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(dead_code)]
-
-fn f(x: || -> !) -> ! {
-    x();
-}
-
-fn main() {
-    let x: || -> ! = || panic!();
-    let _y: || -> ! = || x();
-}
diff --git a/src/test/run-pass/closure-syntax.rs b/src/test/run-pass/closure-syntax.rs
deleted file mode 100644
index 4caa234ac7a..00000000000
--- a/src/test/run-pass/closure-syntax.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(dead_code)]
-#![feature(unboxed_closures)]
-
-// compile-flags:-g
-
-fn foo<T>() {}
-
-trait Bar3 {}
-impl<'b> Bar3 for <'a>|&'a int|: 'b + Send -> &'a int {}
-
-struct Foo<'a> {
-    a: ||: 'a,
-    b: ||: 'static,
-    c: <'b>||: 'a,
-    d: ||: 'a + Sync,
-    e: <'b>|int|: 'a + Sync -> &'b f32,
-}
-
-fn f<'a>(a: &'a int, f: <'b>|&'b int| -> &'b int) -> &'a int {
-    f(a)
-}
-
-fn g<'a>(a: &'a int) -> &'a int {
-    a
-}
-
-struct A;
-
-impl A {
-    fn foo<T>(&self) {}
-}
-
-fn bar<'b>() {
-    foo::<||>();
-    foo::<|| -> ()>();
-    foo::<||:>();
-    foo::<||:'b>();
-    foo::<||:'b + Sync>();
-    foo::<||:Sync>();
-    foo::< <'a>|int, f32, &'a int|:'b + Sync -> &'a int>();
-
-    foo::<<'a>||>();
-
-    // issue #11209
-    let _: ||: 'b; // for comparison
-    let _: <'a> ||;
-
-    let _: Option<||:'b>;
-    let _: Option<<'a>||>;
-    let _: Option< <'a>||>;
-
-    // issue #11210
-    let _: ||: 'static;
-
-    let a = A;
-    a.foo::<<'a>||>();
-
-    // issue #13490
-    let _ = || -> ! loop {};
-
-    // issue #17021
-    let c = box |&:| {};
-}
-
-struct B<T>;
-impl<'b> B<<'a>||: 'b> {}
-
-pub fn main() {
-}
diff --git a/src/test/run-pass/coerce-to-closure-and-proc.rs b/src/test/run-pass/coerce-to-closure-and-proc.rs
deleted file mode 100644
index 413717d9226..00000000000
--- a/src/test/run-pass/coerce-to-closure-and-proc.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(unboxed_closures)]
-
-fn id<T>(x: T) -> T {
-    x
-}
-
-#[derive(PartialEq, Show)]
-struct Foo<T>(T);
-
-#[derive(PartialEq, Show)]
-enum Bar<T> {
-    Baz(T)
-}
-
-pub fn main() {
-    let f: |int| -> int = id;
-    assert_eq!(f(5), 5);
-
-    let f: |int| -> Foo<int> = Foo;
-    assert_eq!(f(5), Foo(5));
-
-    let f: |int| -> Bar<int> = Bar::Baz;
-    assert_eq!(f(5), Bar::Baz(5));
-
-    let f: |int| -> Option<int> = Some;
-    assert_eq!(f(5), Some(5));
-}
diff --git a/src/test/run-pass/const-fn-val.rs b/src/test/run-pass/const-fn-val.rs
index 57e37aaf393..8394c53cba5 100644
--- a/src/test/run-pass/const-fn-val.rs
+++ b/src/test/run-pass/const-fn-val.rs
@@ -12,9 +12,9 @@ fn foo() -> int {
     return 0xca7f000d;
 }
 
-struct Bar<'a> { f: ||: 'a -> int }
+struct Bar<F> where F: FnMut() -> int { f: F }
 
-static mut b : Bar<'static> = Bar { f: foo };
+static mut b : Bar<fn() -> int> = Bar { f: foo as fn() -> int};
 
 pub fn main() {
     unsafe { assert_eq!((b.f)(), 0xca7f000d); }
diff --git a/src/test/run-pass/const-vec-of-fns.rs b/src/test/run-pass/const-vec-of-fns.rs
index 86cac14b443..f21f7d1903c 100644
--- a/src/test/run-pass/const-vec-of-fns.rs
+++ b/src/test/run-pass/const-vec-of-fns.rs
@@ -17,8 +17,8 @@
 
 fn f() { }
 static bare_fns: &'static [fn()] = &[f, f];
-struct S<'a>(||:'a);
-static mut closures: &'static mut [S<'static>] = &mut [S(f), S(f)];
+struct S<F: FnOnce()>(F);
+static mut closures: &'static mut [S<fn()>] = &mut [S(f as fn()), S(f as fn())];
 
 pub fn main() {
     unsafe {
diff --git a/src/test/run-pass/empty-tag.rs b/src/test/run-pass/empty-tag.rs
index 58eb4ce2f7a..d9201746440 100644
--- a/src/test/run-pass/empty-tag.rs
+++ b/src/test/run-pass/empty-tag.rs
@@ -25,6 +25,6 @@ fn wrapper3(i: chan) {
 }
 
 pub fn main() {
-    let wrapped = {||wrapper3(chan::chan_t)};
+    let wrapped = {|&:|wrapper3(chan::chan_t)};
     wrapped();
 }
diff --git a/src/test/run-pass/enum-null-pointer-opt.rs b/src/test/run-pass/enum-null-pointer-opt.rs
index 34ff0b3821c..797c26556aa 100644
--- a/src/test/run-pass/enum-null-pointer-opt.rs
+++ b/src/test/run-pass/enum-null-pointer-opt.rs
@@ -19,9 +19,6 @@ use std::sync::Arc;
 trait Trait {}
 
 fn main() {
-    // Closures - ||
-    assert_eq!(size_of::<||>(), size_of::<Option<||>>());
-
     // Functions
     assert_eq!(size_of::<fn(int)>(), size_of::<Option<fn(int)>>());
     assert_eq!(size_of::<extern "C" fn(int)>(), size_of::<Option<extern "C" fn(int)>>());
diff --git a/src/test/run-pass/expr-block-fn.rs b/src/test/run-pass/expr-block-fn.rs
index 3a6cd61fa09..ed246e2cb7d 100644
--- a/src/test/run-pass/expr-block-fn.rs
+++ b/src/test/run-pass/expr-block-fn.rs
@@ -11,9 +11,8 @@
 
 
 fn test_fn() {
-    type t = ||: 'static -> int;
     fn ten() -> int { return 10; }
-    let rs: t = ten;
+    let rs = ten;
     assert!((rs() == 10));
 }
 
diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs
index ec5013122ac..5c1039fe433 100644
--- a/src/test/run-pass/expr-block-generic-unique1.rs
+++ b/src/test/run-pass/expr-block-generic-unique1.rs
@@ -8,12 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-type compare<'a, T> = |Box<T>, Box<T>|: 'a -> bool;
-
-fn test_generic<T:Clone>(expected: Box<T>, eq: compare<T>) {
+fn test_generic<T, F>(expected: Box<T>, eq: F) where T: Clone, F: FnOnce(Box<T>, Box<T>) -> bool {
     let actual: Box<T> = { expected.clone() };
-    assert!((eq(expected, actual)));
+    assert!(eq(expected, actual));
 }
 
 fn test_box() {
@@ -22,7 +19,7 @@ fn test_box() {
         println!("{}", *b2);
         return *b1 == *b2;
     }
-    test_generic::<bool>(box true, compare_box);
+    test_generic::<bool, _>(box true, compare_box);
 }
 
 pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-block-generic-unique2.rs b/src/test/run-pass/expr-block-generic-unique2.rs
index 48e27dc449c..3d736cca6d5 100644
--- a/src/test/run-pass/expr-block-generic-unique2.rs
+++ b/src/test/run-pass/expr-block-generic-unique2.rs
@@ -8,17 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-type compare<'a, T> = |T, T|: 'a -> bool;
-
-fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
+fn test_generic<T, F>(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool {
     let actual: T = { expected.clone() };
-    assert!((eq(expected, actual)));
+    assert!(eq(expected, actual));
 }
 
 fn test_vec() {
     fn compare_vec(v1: Box<int>, v2: Box<int>) -> bool { return v1 == v2; }
-    test_generic::<Box<int>>(box 1, compare_vec);
+    test_generic::<Box<int>, _>(box 1, compare_vec);
 }
 
 pub fn main() { test_vec(); }
diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs
index f1363c42961..91b847d47cb 100644
--- a/src/test/run-pass/expr-block-generic.rs
+++ b/src/test/run-pass/expr-block-generic.rs
@@ -8,19 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-
-// Tests for standalone blocks as expressions with dynamic type sizes
-type compare<'a, T> = |T, T|: 'a -> bool;
-
-fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
+fn test_generic<T: Clone, F>(expected: T, eq: F) where F: FnOnce(T, T) -> bool {
     let actual: T = { expected.clone() };
-    assert!((eq(expected, actual)));
+    assert!(eq(expected, actual));
 }
 
 fn test_bool() {
     fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
-    test_generic::<bool>(true, compare_bool);
+    test_generic::<bool, _>(true, compare_bool);
 }
 
 #[derive(Clone)]
@@ -33,7 +28,7 @@ fn test_rec() {
     fn compare_rec(t1: Pair, t2: Pair) -> bool {
         t1.a == t2.a && t1.b == t2.b
     }
-    test_generic::<Pair>(Pair {a: 1, b: 2}, compare_rec);
+    test_generic::<Pair, _>(Pair {a: 1, b: 2}, compare_rec);
 }
 
 pub fn main() { test_bool(); test_rec(); }
diff --git a/src/test/run-pass/expr-if-generic.rs b/src/test/run-pass/expr-if-generic.rs
index d9300d0bc33..fb2a120e6f4 100644
--- a/src/test/run-pass/expr-if-generic.rs
+++ b/src/test/run-pass/expr-if-generic.rs
@@ -8,18 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-// Tests for if as expressions with dynamic type sizes
-type compare<T> = |T, T|: 'static -> bool;
-
-fn test_generic<T:Clone>(expected: T, not_expected: T, eq: compare<T>) {
+fn test_generic<T, F>(expected: T, not_expected: T, eq: F) where
+    T: Clone,
+    F: FnOnce(T, T) -> bool,
+{
     let actual: T = if true { expected.clone() } else { not_expected };
-    assert!((eq(expected, actual)));
+    assert!(eq(expected, actual));
 }
 
 fn test_bool() {
     fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
-    test_generic::<bool>(true, false, compare_bool);
+    test_generic::<bool, _>(true, false, compare_bool);
 }
 
 #[derive(Clone)]
@@ -32,7 +31,7 @@ fn test_rec() {
     fn compare_rec(t1: Pair, t2: Pair) -> bool {
         t1.a == t2.a && t1.b == t2.b
     }
-    test_generic::<Pair>(Pair{a: 1, b: 2}, Pair{a: 2, b: 3}, compare_rec);
+    test_generic::<Pair, _>(Pair{a: 1, b: 2}, Pair{a: 2, b: 3}, compare_rec);
 }
 
 pub fn main() { test_bool(); test_rec(); }
diff --git a/src/test/run-pass/expr-match-generic-unique1.rs b/src/test/run-pass/expr-match-generic-unique1.rs
index aed4024b5bc..5fc9a502ca8 100644
--- a/src/test/run-pass/expr-match-generic-unique1.rs
+++ b/src/test/run-pass/expr-match-generic-unique1.rs
@@ -8,22 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-type compare<T> = |Box<T>, Box<T>|: 'static -> bool;
-
-fn test_generic<T:Clone>(expected: Box<T>, eq: compare<T>) {
+fn test_generic<T: Clone, F>(expected: Box<T>, eq: F) where F: FnOnce(Box<T>, Box<T>) -> bool {
     let actual: Box<T> = match true {
         true => { expected.clone() },
         _ => panic!("wat")
     };
-    assert!((eq(expected, actual)));
+    assert!(eq(expected, actual));
 }
 
 fn test_box() {
     fn compare_box(b1: Box<bool>, b2: Box<bool>) -> bool {
         return *b1 == *b2;
     }
-    test_generic::<bool>(box true, compare_box);
+    test_generic::<bool, _>(box true, compare_box);
 }
 
 pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-match-generic-unique2.rs b/src/test/run-pass/expr-match-generic-unique2.rs
index 89adef378f1..e608f9c46c7 100644
--- a/src/test/run-pass/expr-match-generic-unique2.rs
+++ b/src/test/run-pass/expr-match-generic-unique2.rs
@@ -8,20 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-type compare<'a, T> = |T, T|: 'a -> bool;
-
-fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
+fn test_generic<T: Clone, F>(expected: T, eq: F) where F: FnOnce(T, T) -> bool {
     let actual: T = match true {
         true => expected.clone(),
         _ => panic!("wat")
     };
-    assert!((eq(expected, actual)));
+    assert!(eq(expected, actual));
 }
 
 fn test_vec() {
     fn compare_box(v1: Box<int>, v2: Box<int>) -> bool { return v1 == v2; }
-    test_generic::<Box<int>>(box 1, compare_box);
+    test_generic::<Box<int>, _>(box 1, compare_box);
 }
 
 pub fn main() { test_vec(); }
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 1231a49dcd3..09508b9b136 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: ||) { f() }
+fn likes_block<F>(f: F) where F: FnOnce() { f() }
 
 pub fn main() {
     likes_block(bare);
diff --git a/src/test/run-pass/fn-coerce-field.rs b/src/test/run-pass/fn-coerce-field.rs
index 6b7490ba673..bf6926050ba 100644
--- a/src/test/run-pass/fn-coerce-field.rs
+++ b/src/test/run-pass/fn-coerce-field.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct r<'a> {
-    field: ||: 'a,
+struct r<F> where F: FnOnce() {
+    field: F,
 }
 
 pub fn main() {
     fn f() {}
-    let _i: r = r {field: f};
+    let _i: r<fn()> = r {field: f as fn()};
 }
diff --git a/src/test/run-pass/fn-pattern-expected-type.rs b/src/test/run-pass/fn-pattern-expected-type.rs
index fb75abc6ea0..24bf1f94d88 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: |(int,int)| = |(x, y)| {
+    let f = |&: (x, y): (int, int)| {
         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 80d3527736f..ae22ff5cce0 100644
--- a/src/test/run-pass/fn-type-infer.rs
+++ b/src/test/run-pass/fn-type-infer.rs
@@ -12,7 +12,7 @@
 
 pub fn main() {
     // We should be able to type infer inside of ||s.
-    let _f = || {
+    let _f = |&:| {
         let i = 10i;
     };
 }
diff --git a/src/test/run-pass/foreach-nested.rs b/src/test/run-pass/foreach-nested.rs
index 2a54f22ee66..f6466994955 100644
--- a/src/test/run-pass/foreach-nested.rs
+++ b/src/test/run-pass/foreach-nested.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-fn two(it: |int|) { it(0); it(1); }
+fn two<F>(mut it: F) where F: FnMut(int) { it(0); it(1); }
 
 pub fn main() {
     let mut a: Vec<int> = vec!(-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 7a728e18a29..029dddb7a21 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: |(int, int)|) {
+fn pairs<F>(mut it: F) where F: FnMut((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 bb726773bb5..9ccb2dd56cf 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: |int|) {
+fn first_ten<F>(mut it: F) where F: FnMut(int) {
     let mut i: int = 0;
     while i < 10 { println!("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 479f4f8387f..3955bedb168 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: |int| -> int) -> int { let n: int = f(3); return n; }
+fn ho<F>(f: F) -> int where F: FnOnce(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 032db16c617..f992847e4e9 100644
--- a/src/test/run-pass/generic-static-methods.rs
+++ b/src/test/run-pass/generic-static-methods.rs
@@ -10,11 +10,11 @@
 
 
 trait vec_utils<T> {
-    fn map_<U>(x: &Self, f: |&T| -> U) -> Vec<U> ;
+    fn map_<U, F>(x: &Self, f: F) -> Vec<U> where F: FnMut(&T) -> U;
 }
 
 impl<T> vec_utils<T> for Vec<T> {
-    fn map_<U>(x: &Vec<T> , f: |&T| -> U) -> Vec<U> {
+    fn map_<U, F>(x: &Vec<T> , mut f: F) -> Vec<U> where F: FnMut(&T) -> U {
         let mut r = Vec::new();
         for elt in x.iter() {
             r.push(f(elt));
diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs
index 7fd8ca1fd8a..a8ecc2decd0 100644
--- a/src/test/run-pass/hashmap-memory.rs
+++ b/src/test/run-pass/hashmap-memory.rs
@@ -9,14 +9,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unboxed_closures)]
+
 /**
    A somewhat reduced test case to expose some Valgrind issues.
 
    This originally came from the word-count benchmark.
 */
 
-pub fn map(filename: String, emit: map_reduce::putter) {
-    emit(filename, "1".to_string());
+pub fn map(filename: String, mut emit: map_reduce::putter) {
+    emit.call_mut((filename, "1".to_string(),));
 }
 
 mod map_reduce {
@@ -25,7 +27,7 @@ mod map_reduce {
     use std::str;
     use std::thread::Thread;
 
-    pub type putter<'a> = |String, String|: 'a;
+    pub type putter<'a> = Box<FnMut(String, String) + 'a>;
 
     pub type mapper = extern fn(String, putter);
 
@@ -58,7 +60,7 @@ mod map_reduce {
         }
 
         let ctrl_clone = ctrl.clone();
-        ::map(input, |a,b| emit(&mut intermediates, ctrl.clone(), a, b) );
+        ::map(input, box |a,b| emit(&mut intermediates, ctrl.clone(), a, b) );
         ctrl_clone.send(ctrl_proto::mapper_done).unwrap();
     }
 
diff --git a/src/test/run-pass/hrtb-debruijn-object-types-in-closures.rs b/src/test/run-pass/hrtb-debruijn-object-types-in-closures.rs
index 5bdfa3cafd7..9e857a33245 100644
--- a/src/test/run-pass/hrtb-debruijn-object-types-in-closures.rs
+++ b/src/test/run-pass/hrtb-debruijn-object-types-in-closures.rs
@@ -13,8 +13,7 @@ trait Typer<'tcx> {
     fn dummy(&self) { }
 }
 
-fn g(_: |&Typer|) {
-}
+fn g<F>(_: F) where F: FnOnce(&Typer) {}
 
 fn h() {
     g(|typer| typer.dummy())
diff --git a/src/test/run-pass/hrtb-parse.rs b/src/test/run-pass/hrtb-parse.rs
index 53749f09f74..41b7c0fae07 100644
--- a/src/test/run-pass/hrtb-parse.rs
+++ b/src/test/run-pass/hrtb-parse.rs
@@ -40,8 +40,5 @@ fn foo21(t: for<'a> unsafe fn(int) -> int) { }
 fn foo22(t: for<'a> extern "C" fn(int) -> int) { }
 fn foo23(t: for<'a> unsafe extern "C" fn(int) -> int) { }
 
-fn foo30(t: for<'a> |int| -> int) { }
-fn foo31(t: for<'a> unsafe |int| -> int) { }
-
 fn main() {
 }
diff --git a/src/test/run-pass/hrtb-trait-object-passed-to-closure.rs b/src/test/run-pass/hrtb-trait-object-passed-to-closure.rs
index 076b9c7684e..c90c3643d4e 100644
--- a/src/test/run-pass/hrtb-trait-object-passed-to-closure.rs
+++ b/src/test/run-pass/hrtb-trait-object-passed-to-closure.rs
@@ -23,7 +23,7 @@ struct NoAnn<'ast> {
 impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> {
 }
 
-fn foo<'ast> (f: Option<&'ast uint>, g: |&PrinterSupport|) {
+fn foo<'ast, G>(f: Option<&'ast uint>, g: G) where G: FnOnce(&PrinterSupport) {
     let annotation = NoAnn { f: f };
     g(&annotation)
 }
diff --git a/src/test/run-pass/issue-13434.rs b/src/test/run-pass/issue-13434.rs
index e223feede02..e5fd17e2dfe 100644
--- a/src/test/run-pass/issue-13434.rs
+++ b/src/test/run-pass/issue-13434.rs
@@ -15,7 +15,7 @@ trait Repro {
   fn repro(self, s: MyStruct) -> String;
 }
 
-impl Repro for |MyStruct|:'static -> String {
+impl<F> Repro for F where F: FnOnce(MyStruct) -> String {
   fn repro(self, s: MyStruct) -> String {
     self(s)
   }
@@ -26,5 +26,5 @@ fn do_stuff<R: Repro>(r: R) -> String {
 }
 
 pub fn main() {
-  assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{}", s)));
+  assert_eq!("MyStruct".to_string(), do_stuff(|: s: MyStruct| format!("{}", s)));
 }
diff --git a/src/test/run-pass/issue-13507-2.rs b/src/test/run-pass/issue-13507-2.rs
index 626381c334d..4d150e7a68e 100644
--- a/src/test/run-pass/issue-13507-2.rs
+++ b/src/test/run-pass/issue-13507-2.rs
@@ -24,7 +24,6 @@ pub fn type_ids() -> Vec<TypeId> {
     ids.push(TypeId::of::<testtypes::FooEnum>());
     ids.push(TypeId::of::<testtypes::FooUniq>());
     ids.push(TypeId::of::<testtypes::FooPtr>());
-    ids.push(TypeId::of::<testtypes::FooClosure>());
     ids.push(TypeId::of::<&'static testtypes::FooTrait>());
     ids.push(TypeId::of::<testtypes::FooStruct>());
     ids.push(TypeId::of::<testtypes::FooTuple>());
diff --git a/src/test/run-pass/issue-13808.rs b/src/test/run-pass/issue-13808.rs
index e20090adcf6..c0652b946db 100644
--- a/src/test/run-pass/issue-13808.rs
+++ b/src/test/run-pass/issue-13808.rs
@@ -9,12 +9,12 @@
 // except according to those terms.
 
 struct Foo<'a> {
-    listener: ||: 'a
+    listener: Box<FnMut() + 'a>,
 }
 
 impl<'a> Foo<'a> {
-    fn new(listener: ||: 'a) -> Foo<'a> {
-        Foo { listener: listener }
+    fn new<F>(listener: F) -> Foo<'a> where F: FnMut() + 'a {
+        Foo { listener: box listener }
     }
 }
 
diff --git a/src/test/run-pass/issue-1460.rs b/src/test/run-pass/issue-1460.rs
index 8176262abd9..2091a5437c2 100644
--- a/src/test/run-pass/issue-1460.rs
+++ b/src/test/run-pass/issue-1460.rs
@@ -10,5 +10,5 @@
 
 
 pub fn main() {
-    {|i| if 1i == i { }};
+    {|&: i| if 1i == i { }};
 }
diff --git a/src/test/run-pass/issue-14919.rs b/src/test/run-pass/issue-14919.rs
index d66bbe9187a..d5590e99f2c 100644
--- a/src/test/run-pass/issue-14919.rs
+++ b/src/test/run-pass/issue-14919.rs
@@ -16,7 +16,7 @@ trait Matcher {
 
 struct CharPredMatcher<'a, 'b> {
     str: &'a str,
-    pred: |char|:'b -> bool
+    pred: Box<FnMut(char) -> bool + 'b>,
 }
 
 impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> {
@@ -29,11 +29,11 @@ trait IntoMatcher<'a, T> {
     fn into_matcher(self, &'a str) -> T;
 }
 
-impl<'a, 'b> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for |char|:'b -> bool {
+impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b {
     fn into_matcher(self, s: &'a str) -> CharPredMatcher<'a, 'b> {
         CharPredMatcher {
             str: s,
-            pred: self
+            pred: box self,
         }
     }
 }
@@ -57,6 +57,6 @@ fn match_indices<'a, M, T: IntoMatcher<'a, M>>(s: &'a str, from: T) -> MatchIndi
 
 fn main() {
     let s = "abcbdef";
-    match_indices(s, |c: char| c == 'b')
+    match_indices(s, |&mut: c: char| c == 'b')
         .collect::<Vec<(uint, uint)>>();
 }
diff --git a/src/test/run-pass/issue-1516.rs b/src/test/run-pass/issue-1516.rs
deleted file mode 100644
index 3c5af9ca032..00000000000
--- a/src/test/run-pass/issue-1516.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn main() {
-    let early_error: |&str|: 'static -> ! = |_msg| { panic!() };
-}
diff --git a/src/test/run-pass/issue-16256.rs b/src/test/run-pass/issue-16256.rs
index 48ea3a93296..e7422e233a6 100644
--- a/src/test/run-pass/issue-16256.rs
+++ b/src/test/run-pass/issue-16256.rs
@@ -10,5 +10,5 @@
 
 fn main() {
     let mut buf = Vec::new();
-    |c: u8| buf.push(c);
+    |&mut: c: u8| buf.push(c);
 }
diff --git a/src/test/run-pass/issue-2074.rs b/src/test/run-pass/issue-2074.rs
index ebcaf97c5f7..120ada96c15 100644
--- a/src/test/run-pass/issue-2074.rs
+++ b/src/test/run-pass/issue-2074.rs
@@ -11,11 +11,11 @@
 #![allow(non_camel_case_types)]
 
 pub fn main() {
-    let one: || -> uint = || {
+    let one = |&:| {
         enum r { a };
         r::a as uint
     };
-    let two: || -> uint = || {
+    let two = |&:| {
         enum r { a };
         r::a as uint
     };
diff --git a/src/test/run-pass/issue-2487-a.rs b/src/test/run-pass/issue-2487-a.rs
index d8c12d8511c..aa61d52b2a3 100644
--- a/src/test/run-pass/issue-2487-a.rs
+++ b/src/test/run-pass/issue-2487-a.rs
@@ -29,7 +29,7 @@ fn socket() -> socket {
     }
 }
 
-fn closure(f: ||) { f() }
+fn closure<F>(f: F) where F: FnOnce() { f() }
 
 fn setsockopt_bytes(_sock: int) { }
 
diff --git a/src/test/run-pass/issue-3052.rs b/src/test/run-pass/issue-3052.rs
index 00e6b5ca8fe..72cf2219bb6 100644
--- a/src/test/run-pass/issue-3052.rs
+++ b/src/test/run-pass/issue-3052.rs
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 
-type Connection = |Vec<u8>|: 'static;
+type Connection = Box<FnMut(Vec<u8>) + 'static>;
 
 fn f() -> Option<Connection> {
-    let mock_connection: Connection = |_| {};
+    let mock_connection: Connection = box |&mut: _| {};
     Some(mock_connection)
 }
 
diff --git a/src/test/run-pass/issue-3429.rs b/src/test/run-pass/issue-3429.rs
index cce90f8a2cd..60c53450004 100644
--- a/src/test/run-pass/issue-3429.rs
+++ b/src/test/run-pass/issue-3429.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub fn main() {
-  let x = 1;
-  let y: || -> int = || x;
+  let x = 1u;
+  let y = |&:| x;
   let _z = y();
 }
diff --git a/src/test/run-pass/issue-3874.rs b/src/test/run-pass/issue-3874.rs
index c616c09c70e..9226bebd2dc 100644
--- a/src/test/run-pass/issue-3874.rs
+++ b/src/test/run-pass/issue-3874.rs
@@ -10,7 +10,7 @@
 
 enum PureCounter { PureCounterVariant(uint) }
 
-fn each(thing: PureCounter, blk: |v: &uint|) {
+fn each<F>(thing: PureCounter, blk: F) where F: FnOnce(&uint) {
     let PureCounter::PureCounterVariant(ref x) = thing;
     blk(x);
 }
diff --git a/src/test/run-pass/issue-3904.rs b/src/test/run-pass/issue-3904.rs
index 81a7d073c4c..e917ecc745f 100644
--- a/src/test/run-pass/issue-3904.rs
+++ b/src/test/run-pass/issue-3904.rs
@@ -8,21 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type ErrPrinter<'a> = |&str, &str|: 'a;
-
 fn example_err(prog: &str, arg: &str) {
     println!("{}: {}", prog, arg)
 }
 
-fn exit(print: ErrPrinter, prog: &str, arg: &str) {
+fn exit<F>(print: F, prog: &str, arg: &str) where F: FnOnce(&str, &str) {
     print(prog, arg);
 }
 
-struct X<'a> {
-    err: ErrPrinter<'a>
+struct X<F> where F: FnOnce(&str, &str) {
+    err: F,
 }
 
-impl<'a> X<'a> {
+impl<F> X<F> where F: FnOnce(&str, &str) {
     pub fn boom(self) {
         exit(self.err, "prog", "arg");
     }
diff --git a/src/test/run-pass/issue-5239-2.rs b/src/test/run-pass/issue-5239-2.rs
index 863acc5c0c3..69255c57681 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: |int| -> int = |ref x: int| { *x };
+    let _f = |&: 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 fa784e17b10..b2b64e62c39 100644
--- a/src/test/run-pass/issue-6153.rs
+++ b/src/test/run-pass/issue-6153.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-fn swap(f: |Vec<int> | -> Vec<int> ) -> Vec<int> {
+fn swap<F>(f: F) -> Vec<int> where F: FnOnce(Vec<int>) -> Vec<int> {
     let x = vec!(1, 2, 3);
     f(x)
 }
diff --git a/src/test/run-pass/issue-6157.rs b/src/test/run-pass/issue-6157.rs
index 23e70085504..07c7c6888e1 100644
--- a/src/test/run-pass/issue-6157.rs
+++ b/src/test/run-pass/issue-6157.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait OpInt<'a> { fn call(&mut self, int, int) -> int; }
+pub trait OpInt { fn call(&mut self, int, int) -> int; }
 
-impl<'a> OpInt<'a> for |int, int|: 'a -> int {
+impl<F> OpInt for F where F: FnMut(int, int) -> int {
     fn call(&mut self, a:int, b:int) -> int {
         (*self)(a, b)
     }
@@ -21,7 +21,7 @@ fn squarei<'a>(x: int, op: &'a mut OpInt) -> int { op.call(x, x) }
 fn muli(x:int, y:int) -> int { x * y }
 
 pub fn main() {
-    let mut f = |x,y| muli(x,y);
+    let mut f = |&mut: x, y| muli(x, y);
     {
         let g = &mut f;
         let h = g as &mut OpInt;
diff --git a/src/test/run-pass/issue-868.rs b/src/test/run-pass/issue-868.rs
index 99ab83ec620..72bdd1af746 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<T>(g: || -> T) -> T { g() }
+fn f<T, F>(g: F) -> T where F: FnOnce() -> T { g() }
 
 pub fn main() {
   let _x = f( | | { 10i });
@@ -20,5 +20,5 @@ pub fn main() {
     let _: () = f(| | { });
     // empty block with no type info should compile too
     let _ = f(||{});
-    let _ = (||{});
+    let _ = (|&:|{});
 }
diff --git a/src/test/run-pass/issue-9129.rs b/src/test/run-pass/issue-9129.rs
index a6746f45206..3ca060f45a5 100644
--- a/src/test/run-pass/issue-9129.rs
+++ b/src/test/run-pass/issue-9129.rs
@@ -29,7 +29,7 @@ fn Ident_new() -> Ident {
 
 pub fn light_fuse(fld: Box<bomb>) {
     int3!();
-    let f = || {
+    let f = |&:| {
         int3!();
         fld.boom(Ident_new()); // *** 1
     };
diff --git a/src/test/run-pass/iter-range.rs b/src/test/run-pass/iter-range.rs
index 794c4f4016e..29ac563878b 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: |int|) {
+fn range_<F>(a: int, b: int, mut it: F) where F: FnMut(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 190d2501584..b33e6512b18 100644
--- a/src/test/run-pass/lambda-infer-unresolved.rs
+++ b/src/test/run-pass/lambda-infer-unresolved.rs
@@ -16,7 +16,7 @@ struct Refs { refs: Vec<int> , n: int }
 
 pub fn main() {
     let mut e = Refs{refs: vec!(), n: 0};
-    let _f: || = || println!("{}", e.n);
+    let _f = |&:| println!("{}", e.n);
     let x: &[int] = e.refs.as_slice();
     assert_eq!(x.len(), 0);
 }
diff --git a/src/test/run-pass/last-use-in-block.rs b/src/test/run-pass/last-use-in-block.rs
index c0dcf9e6094..8ef5df5d696 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<T>(s: String, f: |String| -> T) -> T {
+fn lp<T, F>(s: String, mut f: F) -> T where F: FnMut(String) -> T {
     while false {
         let r = f(s);
         return (r);
@@ -18,8 +18,8 @@ fn lp<T>(s: String, f: |String| -> T) -> T {
     panic!();
 }
 
-fn apply<T>(s: String, f: |String| -> T) -> T {
-    fn g<T>(s: String, f: |String| -> T) -> T {f(s)}
+fn apply<T, F>(s: String, mut f: F) -> T where F: FnMut(String) -> T {
+    fn g<T, F>(s: String, mut f: F) -> T where F: FnMut(String) -> T {f(s)}
     g(s, |v| { let r = f(v); r })
 }
 
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 c9ea520576a..6615bb6368f 100644
--- a/src/test/run-pass/last-use-in-cap-clause.rs
+++ b/src/test/run-pass/last-use-in-cap-clause.rs
@@ -10,16 +10,17 @@
 
 // Make sure #1399 stays fixed
 
+#![feature(unboxed_closures)]
 
 struct A { a: Box<int> }
 
-fn foo() -> ||: 'static -> int {
+fn foo() -> Box<FnMut() -> int + 'static> {
     let k = box 22i;
     let _u = A {a: k.clone()};
-    let result: ||: 'static -> int = || 22;
-    result
+    let result  = |&mut:| 22;
+    box result
 }
 
 pub fn main() {
-    assert_eq!(foo()(), 22);
+    assert_eq!(foo().call_mut(()), 22);
 }
diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs
index 6d5624e2b58..206d4db3db4 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: Box<int> }
 
 pub fn main() {
-    fn invoke(f: ||) { f(); }
+    fn invoke<F>(f: F) where F: FnOnce() { f(); }
     let k = box 22i;
     let _u = A {a: k.clone()};
     invoke(|| println!("{}", k.clone()) )
diff --git a/src/test/run-pass/match-phi.rs b/src/test/run-pass/match-phi.rs
index c5f39bc1a53..2a0a2b20887 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: |int|) { it(10); }
+fn foo<F>(it: F) where F: FnOnce(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 4f9e573ccff..acd8078b1f4 100644
--- a/src/test/run-pass/monad.rs
+++ b/src/test/run-pass/monad.rs
@@ -11,11 +11,11 @@
 
 
 trait vec_monad<A> {
-    fn bind<B>(&self, f: |&A| -> Vec<B> ) -> Vec<B> ;
+    fn bind<B, F>(&self, f: F ) -> Vec<B> where F: FnMut(&A) -> Vec<B> ;
 }
 
 impl<A> vec_monad<A> for Vec<A> {
-    fn bind<B>(&self, f: |&A| -> Vec<B> ) -> Vec<B> {
+    fn bind<B, F>(&self, mut f: F) -> Vec<B> where F: FnMut(&A) -> Vec<B> {
         let mut r = Vec::new();
         for elt in self.iter() {
             r.extend(f(elt).into_iter());
@@ -25,11 +25,11 @@ impl<A> vec_monad<A> for Vec<A> {
 }
 
 trait option_monad<A> {
-    fn bind<B>(&self, f: |&A| -> Option<B>) -> Option<B>;
+    fn bind<B, F>(&self, f: F) -> Option<B> where F: FnOnce(&A) -> Option<B>;
 }
 
 impl<A> option_monad<A> for Option<A> {
-    fn bind<B>(&self, f: |&A| -> Option<B>) -> Option<B> {
+    fn bind<B, F>(&self, f: F) -> Option<B> where F: FnOnce(&A) -> Option<B> {
         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 4b613e9beaa..b7cd3003e75 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 f2<F>(_thing: F) where F: FnOnce() { }
 
-fn f(thing: ||) {
+fn f<F>(thing: F) where F: FnOnce() {
     f2(thing);
 }
 
diff --git a/src/test/run-pass/mut-function-arguments.rs b/src/test/run-pass/mut-function-arguments.rs
index 39441227f60..f8072851913 100644
--- a/src/test/run-pass/mut-function-arguments.rs
+++ b/src/test/run-pass/mut-function-arguments.rs
@@ -15,7 +15,7 @@ fn f(mut y: Box<int>) {
 }
 
 fn g() {
-    let frob: |Box<int>| = |mut q| { *q = 2; assert!(*q == 2); };
+    let frob = |&: mut q: Box<int>| { *q = 2; assert!(*q == 2); };
     let w = box 37;
     frob(w);
 
diff --git a/src/test/run-pass/mut-in-ident-patterns.rs b/src/test/run-pass/mut-in-ident-patterns.rs
index 139122b7b81..ad9161f9bd4 100644
--- a/src/test/run-pass/mut-in-ident-patterns.rs
+++ b/src/test/run-pass/mut-in-ident-patterns.rs
@@ -75,6 +75,6 @@ pub fn main() {
     x = 30;
     assert_eq!(x, 30);
 
-    (|A { x: mut t }: A| { t = t+1; t })(A { x: 34 });
+    (|&: A { x: mut t }: A| { t = t+1; t })(A { x: 34 });
 
 }
diff --git a/src/test/run-pass/newlambdas.rs b/src/test/run-pass/newlambdas.rs
index 043136fdad9..01875288aef 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: |int| -> int) -> int { f(i) }
+fn f<F>(i: int, f: F) -> int where F: FnOnce(int) -> int { f(i) }
 
-fn g(_g: ||) { }
+fn g<G>(_g: G) where G: FnOnce() { }
 
 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 8262432db60..e422cb80321 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<T>(x: T, f: |T|) {
+fn apply<T, F>(x: T, f: F) where F: FnOnce(T) {
     f(x);
 }
 
diff --git a/src/test/run-pass/pattern-in-closure.rs b/src/test/run-pass/pattern-in-closure.rs
index e4f1df2d637..c718b948f8d 100644
--- a/src/test/run-pass/pattern-in-closure.rs
+++ b/src/test/run-pass/pattern-in-closure.rs
@@ -14,8 +14,8 @@ struct Foo {
 }
 
 pub fn main() {
-    let f = |(x, _): (int, int)| println!("{}", x + 1);
-    let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1);
+    let f = |&: (x, _): (int, int)| println!("{}", x + 1);
+    let g = |&: Foo { x: x, y: _y }: Foo| println!("{}", x + 1);
     f((2, 3));
     g(Foo { x: 1, y: 2 });
 }
diff --git a/src/test/run-pass/purity-infer.rs b/src/test/run-pass/purity-infer.rs
index 3bceefb8318..c5588a29cb5 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: ||) { f(); }
+fn something<F>(f: F) where F: FnOnce() { f(); }
 pub fn main() {
     something(|| println!("hi!") );
 }
diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs
index b4523ce41ce..a7724e68310 100644
--- a/src/test/run-pass/regions-copy-closure.rs
+++ b/src/test/run-pass/regions-copy-closure.rs
@@ -8,11 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unboxed_closures)]
+
 struct closure_box<'a> {
-    cl: ||: 'a,
+    cl: Box<FnMut() + 'a>,
 }
 
-fn box_it(x: ||) -> closure_box {
+fn box_it<'a>(x: Box<FnMut() + 'a>) -> closure_box<'a> {
     closure_box {cl: x}
 }
 
@@ -20,9 +22,9 @@ pub fn main() {
     let mut i = 3i;
     assert_eq!(i, 3);
     {
-        let cl = || i += 1;
-        let cl_box = box_it(cl);
-        (cl_box.cl)();
+        let cl = |&mut:| i += 1;
+        let mut cl_box = box_it(box cl);
+        cl_box.cl.call_mut(());
     }
     assert_eq!(i, 4);
 }
diff --git a/src/test/run-pass/regions-dependent-autofn.rs b/src/test/run-pass/regions-dependent-autofn.rs
index 311fd1bcdf2..e7dc5e99c2b 100644
--- a/src/test/run-pass/regions-dependent-autofn.rs
+++ b/src/test/run-pass/regions-dependent-autofn.rs
@@ -11,9 +11,9 @@
 // Test lifetimes are linked properly when we autoslice a vector.
 // Issue #3148.
 
-fn subslice(v: ||) -> || { v }
+fn subslice<F>(v: F) -> F where F: FnOnce() { v }
 
-fn both(v: ||) -> || {
+fn both<F>(v: F) -> F where F: FnOnce() {
     subslice(subslice(v))
 }
 
diff --git a/src/test/run-pass/regions-fn-subtyping-2.rs b/src/test/run-pass/regions-fn-subtyping-2.rs
index 9d2a959eae1..70c90ee05b3 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: <'a>|x: &'a int, g: |y: &'a int||) {
+fn has_same_region(f: Box<for<'a> FnMut(&'a int, Box<FnMut(&'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: <'b>|x: &'b int, g: |y: &'b int||) {
+fn wants_same_region(_f: Box<for<'b> FnMut(&'b int, Box<FnMut(&'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 705a0e12852..e9f774150dc 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: |x: &uint|) {
+fn ok(f: Box<FnMut(&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: <'r>|y: &'r uint| = |x| { };
+    let mut g: Box<for<'r> FnMut(&'r uint)> = box |x| { };
     g = f;
 }
 
 // This version is the same as above, except that here, g's type is
 // inferred.
-fn ok_inferred(f: |x: &uint|) {
-    let mut g: <'r>|x: &'r uint| = |_| {};
+fn ok_inferred(f: Box<FnMut(&uint)>) {
+    let mut g: Box<for<'r> FnMut(&'r uint)> = box |_| {};
     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 3350c3b65d0..cfb6c858563 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<T>(f: |x: &int| -> T) -> T {
+fn with<T, F>(f: F) -> T where F: FnOnce(&int) -> T {
     f(&20)
 }
 
diff --git a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs
index 77ecb077fef..c796566b79d 100644
--- a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs
+++ b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs
@@ -24,15 +24,15 @@
 
 pub fn main() {
     fn explicit() {
-        fn test(_x: Option<|f: <'a> |g: &'a int||>) {}
-        test(Some(|_f: <'a> |g: &'a int|| {}));
+        fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<for<'a> FnMut(&'a int)>) {}
+        test(Some(box |&mut: _f: Box<for<'a> FnMut(&'a int)>| {}));
     }
 
     // The code below is shorthand for the code above (and more likely
     // to represent what one encounters in practice).
     fn implicit() {
-        fn test(_x: Option<|f:      |g: &   int||>) {}
-        test(Some(|_f:      |g: &   int|| {}));
+        fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<        FnMut(&   int)>) {}
+        test(Some(box |&mut: _f: Box<        FnMut(&   int)>| {}));
     }
 
     explicit();
diff --git a/src/test/run-pass/regions-link-fn-args.rs b/src/test/run-pass/regions-link-fn-args.rs
index 2823622bdf6..8822d388039 100644
--- a/src/test/run-pass/regions-link-fn-args.rs
+++ b/src/test/run-pass/regions-link-fn-args.rs
@@ -13,7 +13,7 @@
 
 #![allow(dead_code)]
 
-fn with<'a>(_: |&'a Vec<int>| -> &'a Vec<int>) { }
+fn with<'a, F>(_: F) where F: FnOnce(&'a Vec<int>) -> &'a Vec<int> { }
 
 fn foo() {
     with(|&ref ints| ints);
diff --git a/src/test/run-pass/regions-params.rs b/src/test/run-pass/regions-params.rs
index c0e821b8d38..0042d3a765b 100644
--- a/src/test/run-pass/regions-params.rs
+++ b/src/test/run-pass/regions-params.rs
@@ -11,7 +11,7 @@
 
 fn region_identity(x: &uint) -> &uint { x }
 
-fn apply<T>(t: T, f: |T| -> T) -> T { f(t) }
+fn apply<T, F>(t: T, f: F) -> T where F: FnOnce(T) -> T { f(t) }
 
 fn parameterized(x: &uint) -> uint {
     let z = apply(x, ({|y|
diff --git a/src/test/run-pass/regions-static-closure.rs b/src/test/run-pass/regions-static-closure.rs
index f1d2adcaf94..0f36dc04575 100644
--- a/src/test/run-pass/regions-static-closure.rs
+++ b/src/test/run-pass/regions-static-closure.rs
@@ -8,19 +8,21 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unboxed_closures)]
+
 struct closure_box<'a> {
-    cl: ||: 'a,
+    cl: Box<FnMut() + 'a>,
 }
 
-fn box_it(x: ||) -> closure_box {
+fn box_it<'a>(x: Box<FnMut() + 'a>) -> closure_box<'a> {
     closure_box {cl: x}
 }
 
-fn call_static_closure(cl: closure_box<'static>) {
-    (cl.cl)();
+fn call_static_closure(mut cl: closure_box<'static>) {
+    cl.cl.call_mut(())
 }
 
 pub fn main() {
-    let cl_box = box_it(|| println!("Hello, world!"));
+    let cl_box = box_it(box |&mut:| println!("Hello, world!"));
     call_static_closure(cl_box);
 }
diff --git a/src/test/run-pass/return-from-closure.rs b/src/test/run-pass/return-from-closure.rs
index b905ebf52fc..899dc8ddbe9 100644
--- a/src/test/run-pass/return-from-closure.rs
+++ b/src/test/run-pass/return-from-closure.rs
@@ -13,7 +13,7 @@
 static mut calls: uint = 0;
 
 fn surrounding() {
-    let return_works = |n: int| {
+    let return_works = |&: n: int| {
         unsafe { calls += 1 }
 
         if n >= 0 { return; }
diff --git a/src/test/run-pass/sendfn-is-a-block.rs b/src/test/run-pass/sendfn-is-a-block.rs
index 3f94c7c8e54..c70ed9a3d74 100644
--- a/src/test/run-pass/sendfn-is-a-block.rs
+++ b/src/test/run-pass/sendfn-is-a-block.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-fn test(f: |uint| -> uint) -> uint {
+fn test<F>(f: F) -> uint where F: FnOnce(uint) -> uint {
     return f(22u);
 }
 
diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs
index ff6e0e4bbc9..74c0663971e 100644
--- a/src/test/run-pass/static-impl.rs
+++ b/src/test/run-pass/static-impl.rs
@@ -26,14 +26,14 @@ mod b {
 
 trait uint_utils {
     fn str(&self) -> String;
-    fn multi(&self, f: |uint|);
+    fn multi<F>(&self, f: F) where F: FnMut(uint);
 }
 
 impl uint_utils for uint {
     fn str(&self) -> String {
         self.to_string()
     }
-    fn multi(&self, f: |uint|) {
+    fn multi<F>(&self, mut f: F) where F: FnMut(uint) {
         let mut c = 0u;
         while c < *self { f(c); c += 1u; }
     }
@@ -41,14 +41,14 @@ impl uint_utils for uint {
 
 trait vec_utils<T> {
     fn length_(&self, ) -> uint;
-    fn iter_(&self, f: |&T|);
-    fn map_<U>(&self, f: |&T| -> U) -> Vec<U> ;
+    fn iter_<F>(&self, f: F) where F: FnMut(&T);
+    fn map_<U, F>(&self, f: F) -> Vec<U> where F: FnMut(&T) -> U;
 }
 
 impl<T> vec_utils<T> for Vec<T> {
     fn length_(&self) -> uint { self.len() }
-    fn iter_(&self, f: |&T|) { for x in self.iter() { f(x); } }
-    fn map_<U>(&self, f: |&T| -> U) -> Vec<U> {
+    fn iter_<F>(&self, mut f: F) where F: FnMut(&T) { for x in self.iter() { f(x); } }
+    fn map_<U, F>(&self, mut f: F) -> Vec<U> where F: FnMut(&T) -> U {
         let mut r = Vec::new();
         for elt in self.iter() {
             r.push(f(elt));
@@ -64,7 +64,7 @@ pub fn main() {
     assert_eq!((vec!(1i)).length_().str(), "1".to_string());
     let vect = vec!(3i, 4).map_(|a| *a + 4);
     assert_eq!(vect[0], 7);
-    let vect = (vec!(3i, 4)).map_::<uint>(|a| *a as uint + 4u);
+    let vect = (vec!(3i, 4)).map_::<uint, _>(|a| *a as uint + 4u);
     assert_eq!(vect[0], 7u);
     let mut x = 0u;
     10u.multi(|_n| x += 2u );
diff --git a/src/test/run-pass/struct-partial-move-1.rs b/src/test/run-pass/struct-partial-move-1.rs
index 8cc4cd142be..043ca121b1b 100644
--- a/src/test/run-pass/struct-partial-move-1.rs
+++ b/src/test/run-pass/struct-partial-move-1.rs
@@ -16,7 +16,7 @@ struct S { val: int }
 impl S { fn new(v: int) -> S { S { val: v } } }
 impl Drop for S { fn drop(&mut self) { } }
 
-pub fn f<T>((b1, b2): (T, T), f: |T| -> T) -> Partial<T> {
+pub fn f<T, F>((b1, b2): (T, T), mut f: F) -> Partial<T> where F: FnMut(T) -> T {
     let p = Partial { x: b1, y: b2 };
 
     // Move of `p` is legal even though we are also moving `p.y`; the
diff --git a/src/test/run-pass/struct-partial-move-2.rs b/src/test/run-pass/struct-partial-move-2.rs
index aafe9e632b1..6327e03e528 100644
--- a/src/test/run-pass/struct-partial-move-2.rs
+++ b/src/test/run-pass/struct-partial-move-2.rs
@@ -18,7 +18,7 @@ impl Drop for S { fn drop(&mut self) { } }
 
 pub type Two<T> = (Partial<T>, Partial<T>);
 
-pub fn f<T>((b1, b2): (T, T), (b3, b4): (T, T), f: |T| -> T) -> Two<T> {
+pub fn f<T, F>((b1, b2): (T, T), (b3, b4): (T, T), mut f: F) -> Two<T> where F: FnMut(T) -> T {
     let p = Partial { x: b1, y: b2 };
     let q = Partial { x: b3, y: b4 };
 
diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs
index 8fda8a95169..33e10cc77b7 100644
--- a/src/test/run-pass/tempfile.rs
+++ b/src/test/run-pass/tempfile.rs
@@ -189,7 +189,7 @@ pub fn dont_double_panic() {
     assert!(r.is_err());
 }
 
-fn in_tmpdir(f: ||) {
+fn in_tmpdir<F>(f: F) where F: FnOnce() {
     let tmpdir = TempDir::new("test").ok().expect("can't make tmpdir");
     assert!(os::change_dir(tmpdir.path()).is_ok());
 
diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs
index c8abfcaa721..b193ad7892a 100644
--- a/src/test/run-pass/trait-bounds-in-arc.rs
+++ b/src/test/run-pass/trait-bounds-in-arc.rs
@@ -11,12 +11,16 @@
 // Tests that a heterogeneous list of existential types can be put inside an Arc
 // and shared between tasks as long as all types fulfill Send.
 
+// ignore-pretty
+
+#![feature(unboxed_closures)]
+
 use std::sync::Arc;
 use std::sync::mpsc::channel;
 use std::thread::Thread;
 
 trait Pet {
-    fn name(&self, blk: |&str|);
+    fn name(&self, blk: Box<FnMut(&str)>);
     fn num_legs(&self) -> uint;
     fn of_good_pedigree(&self) -> bool;
 }
@@ -38,19 +42,19 @@ struct Goldfyshe {
 }
 
 impl Pet for Catte {
-    fn name(&self, blk: |&str|) { blk(self.name.as_slice()) }
+    fn name(&self, mut blk: Box<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
     fn num_legs(&self) -> uint { 4 }
     fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 }
 }
 impl Pet for Dogge {
-    fn name(&self, blk: |&str|) { blk(self.name.as_slice()) }
+    fn name(&self, mut blk: Box<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
     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: |&str|) { blk(self.name.as_slice()) }
+    fn name(&self, mut blk: Box<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
     fn num_legs(&self) -> uint { 0 }
     fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 }
 }
@@ -98,7 +102,7 @@ fn check_legs(arc: Arc<Vec<Box<Pet+Sync+Send>>>) {
 }
 fn check_names(arc: Arc<Vec<Box<Pet+Sync+Send>>>) {
     for pet in arc.iter() {
-        pet.name(|name| {
+        pet.name(box |name| {
             assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8);
         })
     }
diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs
index eeda6e2c88b..d4c1b688b47 100644
--- a/src/test/run-pass/trait-generic.rs
+++ b/src/test/run-pass/trait-generic.rs
@@ -24,10 +24,10 @@ impl to_str for () {
 }
 
 trait map<T> {
-    fn map<U>(&self, f: |&T| -> U) -> Vec<U> ;
+    fn map<U, F>(&self, f: F) -> Vec<U> where F: FnMut(&T) -> U;
 }
 impl<T> map<T> for Vec<T> {
-    fn map<U>(&self, f: |&T| -> U) -> Vec<U> {
+    fn map<U, F>(&self, mut f: F) -> Vec<U> where F: FnMut(&T) -> U {
         let mut r = Vec::new();
         for i in self.iter() {
             r.push(f(i));
diff --git a/src/test/run-pass/type-id-higher-rank.rs b/src/test/run-pass/type-id-higher-rank.rs
index efda7771403..7287d149f51 100644
--- a/src/test/run-pass/type-id-higher-rank.rs
+++ b/src/test/run-pass/type-id-higher-rank.rs
@@ -34,24 +34,6 @@ fn main() {
         let f = TypeId::of::<fn(for<'a> fn(&'a int) -> &'a int)>();
         assert!(e != f);
     }
-    // Stack closures
-    {
-        let a = TypeId::of::<|&'static int, &'static int|>();
-        let b = TypeId::of::<for<'a> |&'static int, &'a int|>();
-        let c = TypeId::of::<for<'a, 'b> |&'a int, &'b int|>();
-        let d = TypeId::of::<for<'a, 'b> |&'b int, &'a int|>();
-        assert!(a != b);
-        assert!(a != c);
-        assert!(a != d);
-        assert!(b != c);
-        assert!(b != d);
-        assert_eq!(c, d);
-
-        // Make sure De Bruijn indices are handled correctly
-        let e = TypeId::of::<for<'a> |(|&'a int| -> &'a int)|>();
-        let f = TypeId::of::<|for<'a> |&'a int| -> &'a int|>();
-        assert!(e != f);
-    }
     // Boxed unboxed closures
     {
         let a = TypeId::of::<Box<Fn(&'static int, &'static int)>>();
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 5bf1a72dc6b..24cc5fab8ed 100644
--- a/src/test/run-pass/type-params-in-for-each.rs
+++ b/src/test/run-pass/type-params-in-for-each.rs
@@ -14,7 +14,7 @@ struct S<T> {
     b: uint,
 }
 
-fn range_(lo: uint, hi: uint, it: |uint|) {
+fn range_<F>(lo: uint, hi: uint, mut it: F) where F: FnMut(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 3a5e0dd8ae3..d22a6652e16 100644
--- a/src/test/run-pass/unnamed_argument_mode.rs
+++ b/src/test/run-pass/unnamed_argument_mode.rs
@@ -13,7 +13,7 @@ fn good(_a: &int) {
 
 // unnamed argument &int is now parse x: &int
 
-fn called(_f: |&int|) {
+fn called<F>(_f: F) where F: FnOnce(&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 ba48ae1c0ce..bd20a174d1e 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 = box 1i;
-    let lam_move: || = || {};
+    let lam_move = |&:| {};
     lam_move();
 }
diff --git a/src/test/run-pass/variadic-ffi.rs b/src/test/run-pass/variadic-ffi.rs
index ec320c1f8a3..3e771897025 100644
--- a/src/test/run-pass/variadic-ffi.rs
+++ b/src/test/run-pass/variadic-ffi.rs
@@ -19,7 +19,7 @@ extern {
     fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int;
 }
 
-unsafe fn check<T>(expected: &str, f: |*mut c_char| -> T) {
+unsafe fn check<T, F>(expected: &str, f: F) where F: FnOnce(*mut c_char) -> T {
     let mut x = [0 as c_char; 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 cc2061c3cf3..57660183333 100644
--- a/src/test/run-pass/vec-matching-fold.rs
+++ b/src/test/run-pass/vec-matching-fold.rs
@@ -10,10 +10,13 @@
 
 #![feature(advanced_slice_patterns)]
 
-fn foldl<T,U:Clone>(values: &[T],
-                    initial: U,
-                    function: |partial: U, element: &T| -> U)
-                    -> U {
+fn foldl<T, U, F>(values: &[T],
+                  initial: U,
+                  mut function: F)
+                  -> U where
+    U: Clone,
+    F: FnMut(U, &T) -> U,
+{
     match values {
         [ref head, tail..] =>
             foldl(tail, function(initial, head), function),
@@ -21,10 +24,13 @@ fn foldl<T,U:Clone>(values: &[T],
     }
 }
 
-fn foldr<T,U:Clone>(values: &[T],
-                    initial: U,
-                    function: |element: &T, partial: U| -> U)
-                    -> U {
+fn foldr<T, U, F>(values: &[T],
+                  initial: U,
+                  mut function: F)
+                  -> U where
+    U: Clone,
+    F: FnMut(&T, U) -> U,
+{
     match values {
         [head.., ref tail] =>
             foldr(head, function(tail, initial), function),
diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs
index f73800b89db..c8ed1a26105 100644
--- a/src/test/run-pass/weird-exprs.rs
+++ b/src/test/run-pass/weird-exprs.rs
@@ -26,7 +26,7 @@ fn what() {
         return while !x.get() { x.set(true); };
     }
     let i = &Cell::new(false);
-    let dont = {||the(i)};
+    let dont = {|&:|the(i)};
     dont();
     assert!((i.get()));
 }