]> git.lizzy.rs Git - rust.git/commitdiff
librustc: Remove remaining uses of `&fn()` in favor of `||`.
authorPatrick Walton <pcwalton@mimiga.net>
Wed, 20 Nov 2013 01:36:32 +0000 (17:36 -0800)
committerPatrick Walton <pcwalton@mimiga.net>
Tue, 26 Nov 2013 16:20:58 +0000 (08:20 -0800)
72 files changed:
doc/po/ja/rust.md.po
doc/po/rust.md.pot
doc/rust.md
src/libextra/sort.rs
src/librustc/front/config.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/filesearch.rs
src/librustc/metadata/tydecode.rs
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/ty_fold.rs
src/librustc/middle/typeck/check/regionmanip.rs
src/librustc/middle/typeck/infer/lattice.rs
src/librustc/util/common.rs
src/librustdoc/html/format.rs
src/librustdoc/html/render.rs
src/librustpkg/installed_packages.rs
src/librustpkg/package_source.rs
src/librustpkg/path_util.rs
src/librustpkg/sha1.rs
src/librustpkg/util.rs
src/librustpkg/workspace.rs
src/libstd/cleanup.rs
src/libstd/condition.rs
src/libstd/iter.rs
src/libstd/rand/distributions/mod.rs
src/libstd/str.rs
src/libstd/to_bytes.rs
src/libstd/unstable/finally.rs
src/libstd/vec.rs
src/libsyntax/ast_util.rs
src/libsyntax/ext/deriving/generic.rs
src/libsyntax/ext/deriving/mod.rs
src/test/auxiliary/iss.rs
src/test/bench/shootout-meteor.rs
src/test/compile-fail/issue-4335.rs
src/test/compile-fail/issue-4523.rs
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
src/test/compile-fail/regions-freevar.rs
src/test/compile-fail/regions-infer-at-fn-not-param.rs
src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
src/test/compile-fail/regions-infer-not-param.rs
src/test/compile-fail/regions-steal-closure.rs
src/test/run-fail/unwind-lambda.rs
src/test/run-pass/const-fn-val.rs
src/test/run-pass/const-vec-of-fns.rs
src/test/run-pass/expr-block-fn.rs
src/test/run-pass/expr-block-generic-box1.rs
src/test/run-pass/expr-block-generic-box2.rs
src/test/run-pass/expr-block-generic-unique1.rs
src/test/run-pass/expr-block-generic-unique2.rs
src/test/run-pass/expr-block-generic.rs
src/test/run-pass/expr-if-generic-box1.rs
src/test/run-pass/expr-if-generic-box2.rs
src/test/run-pass/expr-if-generic.rs
src/test/run-pass/expr-match-generic-box1.rs
src/test/run-pass/expr-match-generic-box2.rs
src/test/run-pass/expr-match-generic-unique1.rs
src/test/run-pass/expr-match-generic-unique2.rs
src/test/run-pass/fn-coerce-field.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/issue-1516.rs
src/test/run-pass/issue-2185.rs
src/test/run-pass/issue-3052.rs
src/test/run-pass/last-use-in-cap-clause.rs
src/test/run-pass/regions-copy-closure.rs
src/test/run-pass/regions-dependent-autofn.rs
src/test/run-pass/regions-static-closure.rs

index 24f07337df9ffde26cc7b9f6aa07700c79d0fc8c..99392964e7aadde9d6d6cf6adec5ce5c98db3068 100644 (file)
@@ -5383,7 +5383,7 @@ msgstr ""
 #. type: Plain text
 #: doc/rust.md:2849
 msgid ""
-"type Binop<'self> = &'self fn(int,int) -> int; let bo: Binop = add; x = "
+"type Binop<'self> = 'self |int,int| -> int; let bo: Binop = add; x = "
 "bo(5,7); ~~~~~~~~"
 msgstr ""
 
index 80116dad4d33c0e737ccbd9c6c8aab948ffe014f..1914526cb921f6fcccf297d64bf4f66262ef5be5 100644 (file)
@@ -5370,7 +5370,7 @@ msgstr ""
 #. type: Plain text
 #: doc/rust.md:2849
 msgid ""
-"type Binop<'self> = &'self fn(int,int) -> int; let bo: Binop = add; x = "
+"type Binop<'self> = 'self |int,int| -> int; let bo: Binop = add; x = "
 "bo(5,7); ~~~~~~~~"
 msgstr ""
 
index fe8d0a834e3e416d1d652a9f689617aad173a8ce..bfc18a8473bc360479c4e81a2bcae1f81ea69984 100644 (file)
@@ -3194,7 +3194,7 @@ fn add(x: int, y: int) -> int {
 
 let mut x = add(5,7);
 
-type Binop<'self> = &'self fn(int,int) -> int;
+type Binop<'self> = 'self |int,int| -> int;
 let bo: Binop = add;
 x = bo(5,7);
 ~~~~
index 60c4a75104b601f86bbdf8d93ad5730e6642d31a..175eaa2a8db818f53a36668fa236689267c4b7a9 100644 (file)
@@ -15,7 +15,7 @@
 use std::util::swap;
 use std::vec;
 
-type Le<'self, T> = &'self fn(v1: &T, v2: &T) -> bool;
+type Le<'self, T> = 'self |v1: &T, v2: &T| -> bool;
 
 /**
  * Merge sort. Returns a new vector containing the sorted list.
index 296e8578cbe7c9bd215b7790b1a02a1f94c6ab78..460f1ff1262ff974ad48271410616da69cb95f32 100644 (file)
@@ -13,7 +13,7 @@
 use syntax::{ast, fold, attr};
 
 struct Context<'self> {
-    in_cfg: &'self fn(attrs: &[ast::Attribute]) -> bool,
+    in_cfg: 'self |attrs: &[ast::Attribute]| -> bool,
 }
 
 // Support conditional compilation by transforming the AST, stripping out
index fbe3d7bbe9eea5c2f39940a4f1fa9bd47321007c..dd70d29ec5b2da5ec5a99a82b912da247e6b6525 100644 (file)
@@ -74,7 +74,7 @@ fn lookup_hash(d: ebml::Doc, eq_fn: |&[u8]| -> bool, hash: u64) ->
     ret
 }
 
-pub type GetCrateDataCb<'self> = &'self fn(ast::CrateNum) -> Cmd;
+pub type GetCrateDataCb<'self> = 'self |ast::CrateNum| -> Cmd;
 
 pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option<ebml::Doc> {
     fn eq_item(bytes: &[u8], item_id: int) -> bool {
@@ -528,7 +528,7 @@ struct EachItemContext<'self> {
     cdata: Cmd,
     get_crate_data: GetCrateDataCb<'self>,
     path_builder: &'self mut ~str,
-    callback: &'self fn(&str, DefLike, ast::visibility) -> bool,
+    callback: 'self |&str, DefLike, ast::visibility| -> bool,
 }
 
 impl<'self> EachItemContext<'self> {
@@ -901,11 +901,11 @@ pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> ast_map::path {
     item_path(lookup_item(id, cdata.data))
 }
 
-pub type decode_inlined_item<'self> = &'self fn(
-    cdata: @cstore::crate_metadata,
-    tcx: ty::ctxt,
-    path: ast_map::path,
-    par_doc: ebml::Doc) -> Option<ast::inlined_item>;
+pub type decode_inlined_item<'self> = 'self |cdata: @cstore::crate_metadata,
+                                             tcx: ty::ctxt,
+                                             path: ast_map::path,
+                                             par_doc: ebml::Doc|
+                                             -> Option<ast::inlined_item>;
 
 pub fn maybe_get_item_ast(cdata: Cmd, tcx: ty::ctxt,
                           id: ast::NodeId,
index 340a4241da23bded7c4047468892d5bcb235a4b1..c22f05d249cdeb41d5a7bc7823c7db18980642bd 100644 (file)
 // used by astencode:
 type abbrev_map = @mut HashMap<ty::t, tyencode::ty_abbrev>;
 
-pub type encode_inlined_item<'self> = &'self fn(ecx: &EncodeContext,
-                                   ebml_w: &mut writer::Encoder,
-                                   path: &[ast_map::path_elt],
-                                   ii: ast::inlined_item);
+pub type encode_inlined_item<'self> = 'self |ecx: &EncodeContext,
+                                             ebml_w: &mut writer::Encoder,
+                                             path: &[ast_map::path_elt],
+                                             ii: ast::inlined_item|;
 
 pub struct EncodeParams<'self> {
     diag: @mut span_handler,
index eccbe049e2b9085973a6678ebfcdbeb8f313aba5..4a27450bb43d8de9dd721838767ed55cf8e49062 100644 (file)
@@ -23,7 +23,7 @@ pub enum FileMatch { FileMatches, FileDoesntMatch }
 
 /// Functions with type `pick` take a parent directory as well as
 /// a file found in that directory.
-pub type pick<'self> = &'self fn(path: &Path) -> FileMatch;
+pub type pick<'self> = 'self |path: &Path| -> FileMatch;
 
 pub fn pick_file(file: Path, path: &Path) -> Option<Path> {
     if path.filename() == Some(file.as_vec()) {
index 281998b08114674ef8cdd18bec24b6f17f366984..27bca78b7b7255ae0ce4119d2c7460e44e2e4c09 100644 (file)
@@ -54,7 +54,7 @@ pub enum DefIdSource {
     RegionParameter,
 }
 type conv_did<'self> =
-    &'self fn(source: DefIdSource, ast::DefId) -> ast::DefId;
+    'self |source: DefIdSource, ast::DefId| -> ast::DefId;
 
 pub struct PState<'self> {
     data: &'self [u8],
index 92913983d865977c0bf1741835d5e19e5ead147a..27d1e887bd32fd06ec03355928bb7b94050f1a80 100644 (file)
@@ -477,7 +477,7 @@ fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::Pat) {
     }
 }
 
-type enter_pat<'self> = &'self fn(@ast::Pat) -> Option<~[@ast::Pat]>;
+type enter_pat<'self> = 'self |@ast::Pat| -> Option<~[@ast::Pat]>;
 
 fn enter_match<'r>(bcx: @mut Block,
                        dm: DefMap,
index 0ece7c8c024deb728a3a8bc1acc6f0e9bfce72b6..ea9690ce40609cb427c347ab0af6f27596d3df21 100644 (file)
@@ -669,7 +669,8 @@ fn die(cx: @mut Block) -> ! {
     }
 }
 
-pub type val_and_ty_fn<'self> = &'self fn(@mut Block, ValueRef, ty::t) -> @mut Block;
+pub type val_and_ty_fn<'self> = 'self |@mut Block, ValueRef, ty::t|
+                                       -> @mut Block;
 
 pub fn load_inbounds(cx: @mut Block, p: ValueRef, idxs: &[uint]) -> ValueRef {
     return Load(cx, GEPi(cx, p, idxs));
index 0993d3322f1e650b849d5d79a62c7af5e0353bfe..3eef1267429c74f4164b98544b3fa3c3883eab8b 100644 (file)
@@ -642,7 +642,8 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
     return inf;
 }
 
-pub type glue_helper<'self> = &'self fn(@mut Block, ValueRef, ty::t) -> @mut Block;
+pub type glue_helper<'self> = 'self |@mut Block, ValueRef, ty::t|
+                                     -> @mut Block;
 
 pub fn declare_generic_glue(ccx: &mut CrateContext, t: ty::t, llfnty: Type,
                             name: &str) -> ValueRef {
index 93718fc1a238292b2a1edd09d3da4ca9bb536f52..82615b1e119a08bb46fe25942023973f3e474074 100644 (file)
@@ -539,7 +539,8 @@ pub fn get_base_and_len(bcx: @mut Block, llval: ValueRef, vec_ty: ty::t) -> (Val
     }
 }
 
-pub type iter_vec_block<'self> = &'self fn(@mut Block, ValueRef, ty::t) -> @mut Block;
+pub type iter_vec_block<'self> = 'self |@mut Block, ValueRef, ty::t|
+                                        -> @mut Block;
 
 pub fn iter_vec_loop(bcx: @mut Block,
                      data_ptr: ValueRef,
index dc4fca0176a5f94ca938af46ca3260349bf7fbef..2f35121dc02aea1be251d5568920e145df6d4f13 100644 (file)
@@ -224,7 +224,7 @@ pub fn super_fold_trait_store<T:TypeFolder>(this: &mut T,
 
 pub struct BottomUpFolder<'self> {
     tcx: ty::ctxt,
-    fldop: &'self fn(ty::t) -> ty::t,
+    fldop: 'self |ty::t| -> ty::t,
 }
 
 impl<'self> TypeFolder for BottomUpFolder<'self> {
@@ -241,14 +241,14 @@ fn fold_ty(&mut self, ty: ty::t) -> ty::t {
 
 pub struct RegionFolder<'self> {
     tcx: ty::ctxt,
-    fld_t: &'self fn(ty::t) -> ty::t,
-    fld_r: &'self fn(ty::Region) -> ty::Region,
+    fld_t: 'self |ty::t| -> ty::t,
+    fld_r: 'self |ty::Region| -> ty::Region,
 }
 
 impl<'self> RegionFolder<'self> {
     pub fn general(tcx: ty::ctxt,
-                   fld_r: &'self fn(ty::Region) -> ty::Region,
-                   fld_t: &'self fn(ty::t) -> ty::t)
+                   fld_r: 'self |ty::Region| -> ty::Region,
+                   fld_t: 'self |ty::t| -> ty::t)
                    -> RegionFolder<'self> {
         RegionFolder {
             tcx: tcx,
@@ -257,8 +257,7 @@ pub fn general(tcx: ty::ctxt,
         }
     }
 
-    pub fn regions(tcx: ty::ctxt,
-                   fld_r: &'self fn(ty::Region) -> ty::Region)
+    pub fn regions(tcx: ty::ctxt, fld_r: 'self |ty::Region| -> ty::Region)
                    -> RegionFolder<'self> {
         fn noop(t: ty::t) -> ty::t { t }
 
index ebdd4b5f48c2fef426b1d5d33eeb76c8eb77a109..7bf5eacb3d5c47184fec53a9c3c3fc0764a16c50 100644 (file)
@@ -88,7 +88,7 @@ pub fn relate_nested_regions(tcx: ty::ctxt,
     struct RegionRelator<'self> {
         tcx: ty::ctxt,
         stack: ~[ty::Region],
-        relate_op: &'self fn(ty::Region, ty::Region),
+        relate_op: 'self |ty::Region, ty::Region|,
     }
 
     // FIXME(#10151) -- Define more precisely when a region is
index 04bf5fda7258dab00abc2f51c30be8efd681262f..dbf11ab68bcae4936e66e98fe7459af3211f9071 100644 (file)
@@ -52,7 +52,7 @@ pub trait LatticeValue {
 }
 
 pub type LatticeOp<'self, T> =
-    &'self fn(cf: &CombineFields, a: &T, b: &T) -> cres<T>;
+    'self |cf: &CombineFields, a: &T, b: &T| -> cres<T>;
 
 impl LatticeValue for ty::t {
     fn sub(cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures {
@@ -407,7 +407,7 @@ pub fn super_lattice_tys<L:LatticeDir+TyLatticeDir+Combine>(this: &L,
     }
 }
 
-pub type LatticeDirOp<'self, T> = &'self fn(a: &T, b: &T) -> cres<T>;
+pub type LatticeDirOp<'self, T> = 'self |a: &T, b: &T| -> cres<T>;
 
 #[deriving(Clone)]
 pub enum LatticeVarResult<V,T> {
index ffbea94c4774bfa5381d6d4b47ee13aee56b2c75..28fe067293b8998fee22e81b26bea40473c9bc02 100644 (file)
@@ -61,7 +61,7 @@ pub fn field_exprs(fields: ~[ast::Field]) -> ~[@ast::Expr] {
 }
 
 struct LoopQueryVisitor<'self> {
-    p: &'self fn(&ast::Expr_) -> bool,
+    p: 'self |&ast::Expr_| -> bool,
     flag: bool,
 }
 
@@ -89,7 +89,7 @@ pub fn loop_query(b: &ast::Block, p: |&ast::Expr_| -> bool) -> bool {
 }
 
 struct BlockQueryVisitor<'self> {
-    p: &'self fn(@ast::Expr) -> bool,
+    p: 'self |@ast::Expr| -> bool,
     flag: bool,
 }
 
index ee2aaee240ec8370761adcea226792caefc4e25b..b191eb37af1bc0fadc14c6011983a96f6b3dd416 100644 (file)
@@ -148,8 +148,8 @@ fn external_path(w: &mut io::Writer, p: &clean::Path, print_all: bool,
 }
 
 fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
-        root: &fn(&render::Cache, &[~str]) -> Option<~str>,
-        info: &fn(&render::Cache) -> Option<(~[~str], &'static str)>) {
+        root: |&render::Cache, &[~str]| -> Option<~str>,
+        info: |&render::Cache| -> Option<(~[~str], &'static str)>) {
     // The generics will get written to both the title and link
     let mut generics = ~"";
     let last = path.segments.last();
index 96219479e104bdd31c4faee42a00f430b3217332..9f0a4cefc4c12bf6d9eb78e7a4443bbd5b4fdd17 100644 (file)
@@ -335,7 +335,7 @@ fn mkdir(path: &Path) {
 /// things like ".." to components which preserve the "top down" hierarchy of a
 /// static HTML tree.
 // FIXME (#9639): The closure should deal with &[u8] instead of &str
-fn clean_srcpath(src: &[u8], f: &fn(&str)) {
+fn clean_srcpath(src: &[u8], f: |&str|) {
     let p = Path::new(src);
     if p.as_vec() != bytes!(".") {
         for c in p.str_components().map(|x|x.unwrap()) {
@@ -645,7 +645,7 @@ fn generics(&mut self, generics: &clean::Generics) {
 impl Context {
     /// Recurse in the directory structure and change the "root path" to make
     /// sure it always points to the top (relatively)
-    fn recurse<T>(&mut self, s: ~str, f: &fn(&mut Context) -> T) -> T {
+    fn recurse<T>(&mut self, s: ~str, f: |&mut Context| -> T) -> T {
         if s.len() == 0 {
             fail!("what {:?}", self);
         }
@@ -768,7 +768,7 @@ fn worker(cache: RWArc<Cache>,
     /// all sub-items which need to be rendered.
     ///
     /// The rendering driver uses this closure to queue up more work.
-    fn item(&mut self, item: clean::Item, f: &fn(&mut Context, clean::Item)) {
+    fn item(&mut self, item: clean::Item, f: |&mut Context, clean::Item|) {
         fn render(w: io::File, cx: &mut Context, it: &clean::Item,
                   pushname: bool) {
             // A little unfortunate that this is done like this, but it sure
index 855f6bbc3e50f855a0e4e2e32fa92c945ca6bf87..3eed6314a03339cd41673b784b4dbd751aeb3020 100644 (file)
@@ -16,7 +16,7 @@
 use std::io;
 use std::io::fs;
 
-pub fn list_installed_packages(f: &fn(&PkgId) -> bool) -> bool  {
+pub fn list_installed_packages(f: |&PkgId| -> bool) -> bool  {
     let workspaces = rust_path();
     for p in workspaces.iter() {
         let binfiles = do io::ignore_io_error { fs::readdir(&p.join("bin")) };
index 7e1430792ffbddc0c978799ec9c066ce44f37cdc..4f48dab811f279b93bf4f63557e48a2ce49d1dcf 100644 (file)
@@ -348,7 +348,7 @@ pub fn find_crates(&mut self) {
         self.find_crates_with_filter(|_| true);
     }
 
-    pub fn find_crates_with_filter(&mut self, filter: &fn(&str) -> bool) {
+    pub fn find_crates_with_filter(&mut self, filter: |&str| -> bool) {
         use conditions::missing_pkg_files::cond;
 
         let prefix = self.start_dir.components().len();
index bce41e5a49fe0560fd04103a87402cf574a79b75..adf86d2cf9d750ecbcce5913f338cd006fd3cd3d 100644 (file)
@@ -63,7 +63,7 @@ pub fn workspace_contains_package_id(pkgid: &PkgId, workspace: &Path) -> bool {
 
 pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path,
 // Returns the directory it was actually found in
-             workspace_to_src_dir: &fn(&Path) -> Path) -> Option<Path> {
+             workspace_to_src_dir: |&Path| -> Path) -> Option<Path> {
     if !workspace.is_dir() {
         return None;
     }
index d955fd1aa97d04426df99241f59dfa6cf7bf8ada..db31f603d6ee0ed8881e82d78f944cf4382c2904 100644 (file)
@@ -94,7 +94,7 @@ fn add_bytes_to_bits<T: Int + CheckedAdd + ToBits>(bits: T, bytes: T) -> T {
 trait FixedBuffer {
     /// Input a vector of bytes. If the buffer becomes full, process it with the provided
     /// function and then clear the buffer.
-    fn input(&mut self, input: &[u8], func: &fn(&[u8]));
+    fn input(&mut self, input: &[u8], func: |&[u8]|);
 
     /// Reset the buffer.
     fn reset(&mut self);
@@ -137,7 +137,7 @@ fn new() -> FixedBuffer64 {
 }
 
 impl FixedBuffer for FixedBuffer64 {
-    fn input(&mut self, input: &[u8], func: &fn(&[u8])) {
+    fn input(&mut self, input: &[u8], func: |&[u8]|) {
         let mut i = 0;
 
         let size = 64;
@@ -217,11 +217,11 @@ trait StandardPadding {
     /// and is guaranteed to have exactly rem remaining bytes when it returns. If there are not at
     /// least rem bytes available, the buffer will be zero padded, processed, cleared, and then
     /// filled with zeros again until only rem bytes are remaining.
-    fn standard_padding(&mut self, rem: uint, func: &fn(&[u8]));
+    fn standard_padding(&mut self, rem: uint, func: |&[u8]|);
 }
 
 impl <T: FixedBuffer> StandardPadding for T {
-    fn standard_padding(&mut self, rem: uint, func: &fn(&[u8])) {
+    fn standard_padding(&mut self, rem: uint, func: |&[u8]|) {
         let size = self.size();
 
         self.next(1)[0] = 128;
index 4f3d431543b7df5967ed5c0e5c7525056ff57ee6..befb6aaa2180961ab6905e8af356101adfabcfb6 100644 (file)
@@ -425,7 +425,7 @@ struct ViewItemVisitor<'self> {
     sess: session::Session,
     exec: &'self mut workcache::Exec,
     c: &'self ast::Crate,
-    save: &'self fn(Path),
+    save: 'self |Path|,
     deps: &'self mut DepMap
 }
 
@@ -587,7 +587,7 @@ pub fn find_and_install_dependencies(context: &BuildContext,
                                      exec: &mut workcache::Exec,
                                      c: &ast::Crate,
                                      deps: &mut DepMap,
-                                     save: &fn(Path)) {
+                                     save: |Path|) {
     debug!("In find_and_install_dependencies...");
     let mut visitor = ViewItemVisitor {
         context: context,
index e65f3ce5bb6ab0b81f7a89abf7c0437e3f5c8fe9..22d673333e9542ee01eef7906a22d175ff07c6a6 100644 (file)
 use util::option_to_vec;
 use package_id::PkgId;
 
-pub fn each_pkg_parent_workspace(cx: &Context, pkgid: &PkgId, action: &fn(&Path) -> bool) -> bool {
+pub fn each_pkg_parent_workspace(cx: &Context,
+                                 pkgid: &PkgId,
+                                 action: |&Path| -> bool)
+                                 -> bool {
     // Using the RUST_PATH, find workspaces that contain
     // this package ID
     let workspaces = pkg_parent_workspaces(cx, pkgid);
index a1f850978656260a481c16423a3130981f433dc2..2f7b27b55e3215e6f29e910eb1e1305e9921b44a 100644 (file)
@@ -15,7 +15,7 @@
 use unstable::intrinsics::TyDesc;
 use unstable::raw;
 
-type DropGlue<'self> = &'self fn(**TyDesc, *c_void);
+type DropGlue<'self> = 'self |**TyDesc, *c_void|;
 
 /*
  * Box annihilation
index 56d5a8594012fd1b118a5cabe45f6b16fec2a51c..03994043dcf0cea95f6e0ecb2ca25ccc448a8c24 100644 (file)
@@ -104,7 +104,7 @@ impl<T, U> Condition<T, U> {
     /// // use `trap`'s inside method to register the handler and then run a
     /// // block of code with the handler registered
     /// ```
-    pub fn trap<'a>(&'a self, h: &'a fn(T) -> U) -> Trap<'a, T, U> {
+    pub fn trap<'a>(&'a self, h: 'a |T| -> U) -> Trap<'a, T, U> {
         let h: Closure = unsafe { ::cast::transmute(h) };
         let prev = local_data::get(self.key, |k| k.map(|x| *x));
         let h = @Handler { handle: h, prev: prev };
@@ -181,7 +181,7 @@ impl<'self, T, U> Trap<'self, T, U> {
     /// };
     /// assert_eq!(result, 7);
     /// ```
-    pub fn inside<V>(&self, inner: &'self fn() -> V) -> V {
+    pub fn inside<V>(&self, inner: 'self || -> V) -> V {
         let _g = Guard { cond: self.cond };
         debug!("Trap: pushing handler to TLS");
         local_data::set(self.cond.key, self.handler);
index f736b10cc4fc58d493c5d9b730444a50db731805..b1958bde60d2a7b1d25d8157c246d73482daf416 100644 (file)
@@ -156,7 +156,7 @@ fn zip<B, U: Iterator<B>>(self, other: U) -> Zip<Self, U> {
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
-    fn map<'r, B>(self, f: &'r fn(A) -> B) -> Map<'r, A, B, Self> {
+    fn map<'r, B>(self, f: 'r |A| -> B) -> Map<'r, A, B, Self> {
         Map{iter: self, f: f}
     }
 
@@ -173,7 +173,7 @@ fn map<'r, B>(self, f: &'r fn(A) -> B) -> Map<'r, A, B, Self> {
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
-    fn filter<'r>(self, predicate: &'r fn(&A) -> bool) -> Filter<'r, A, Self> {
+    fn filter<'r>(self, predicate: 'r |&A| -> bool) -> Filter<'r, A, Self> {
         Filter{iter: self, predicate: predicate}
     }
 
@@ -190,7 +190,7 @@ fn filter<'r>(self, predicate: &'r fn(&A) -> bool) -> Filter<'r, A, Self> {
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
-    fn filter_map<'r, B>(self, f: &'r fn(A) -> Option<B>) -> FilterMap<'r, A, B, Self> {
+    fn filter_map<'r, B>(self, f: 'r |A| -> Option<B>) -> FilterMap<'r, A, B, Self> {
         FilterMap { iter: self, f: f }
     }
 
@@ -249,7 +249,7 @@ fn peekable(self) -> Peekable<A, Self> {
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
-    fn skip_while<'r>(self, predicate: &'r fn(&A) -> bool) -> SkipWhile<'r, A, Self> {
+    fn skip_while<'r>(self, predicate: 'r |&A| -> bool) -> SkipWhile<'r, A, Self> {
         SkipWhile{iter: self, flag: false, predicate: predicate}
     }
 
@@ -267,7 +267,7 @@ fn skip_while<'r>(self, predicate: &'r fn(&A) -> bool) -> SkipWhile<'r, A, Self>
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
-    fn take_while<'r>(self, predicate: &'r fn(&A) -> bool) -> TakeWhile<'r, A, Self> {
+    fn take_while<'r>(self, predicate: 'r |&A| -> bool) -> TakeWhile<'r, A, Self> {
         TakeWhile{iter: self, flag: false, predicate: predicate}
     }
 
@@ -327,7 +327,7 @@ fn take(self, n: uint) -> Take<Self> {
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
-    fn scan<'r, St, B>(self, initial_state: St, f: &'r fn(&mut St, A) -> Option<B>)
+    fn scan<'r, St, B>(self, initial_state: St, f: 'r |&mut St, A| -> Option<B>)
         -> Scan<'r, A, B, Self, St> {
         Scan{iter: self, f: f, state: initial_state}
     }
@@ -349,7 +349,7 @@ fn scan<'r, St, B>(self, initial_state: St, f: &'r fn(&mut St, A) -> Option<B>)
     /// }
     /// ```
     #[inline]
-    fn flat_map<'r, B, U: Iterator<B>>(self, f: &'r fn(A) -> U)
+    fn flat_map<'r, B, U: Iterator<B>>(self, f: 'r |A| -> U)
         -> FlatMap<'r, A, Self, U> {
         FlatMap{iter: self, f: f, frontiter: None, backiter: None }
     }
@@ -401,7 +401,7 @@ fn fuse(self) -> Fuse<Self> {
     ///println(sum.to_str());
     /// ```
     #[inline]
-    fn inspect<'r>(self, f: &'r fn(&A)) -> Inspect<'r, A, Self> {
+    fn inspect<'r>(self, f: 'r |&A|) -> Inspect<'r, A, Self> {
         Inspect{iter: self, f: f}
     }
 
@@ -1123,7 +1123,7 @@ fn idx(&self, index: uint) -> Option<(A, B)> {
 /// An iterator which maps the values of `iter` with `f`
 pub struct Map<'self, A, B, T> {
     priv iter: T,
-    priv f: &'self fn(A) -> B
+    priv f: 'self |A| -> B
 }
 
 impl<'self, A, B, T> Map<'self, A, B, T> {
@@ -1172,7 +1172,7 @@ fn idx(&self, index: uint) -> Option<B> {
 /// An iterator which filters the elements of `iter` with `predicate`
 pub struct Filter<'self, A, T> {
     priv iter: T,
-    priv predicate: &'self fn(&A) -> bool
+    priv predicate: 'self |&A| -> bool
 }
 
 impl<'self, A, T: Iterator<A>> Iterator<A> for Filter<'self, A, T> {
@@ -1216,7 +1216,7 @@ fn next_back(&mut self) -> Option<A> {
 /// An iterator which uses `f` to both filter and map elements from `iter`
 pub struct FilterMap<'self, A, B, T> {
     priv iter: T,
-    priv f: &'self fn(A) -> Option<B>
+    priv f: 'self |A| -> Option<B>
 }
 
 impl<'self, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'self, A, B, T> {
@@ -1359,7 +1359,7 @@ pub fn peek(&'self mut self) -> Option<&'self A> {
 pub struct SkipWhile<'self, A, T> {
     priv iter: T,
     priv flag: bool,
-    priv predicate: &'self fn(&A) -> bool
+    priv predicate: 'self |&A| -> bool
 }
 
 impl<'self, A, T: Iterator<A>> Iterator<A> for SkipWhile<'self, A, T> {
@@ -1397,7 +1397,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 pub struct TakeWhile<'self, A, T> {
     priv iter: T,
     priv flag: bool,
-    priv predicate: &'self fn(&A) -> bool
+    priv predicate: 'self |&A| -> bool
 }
 
 impl<'self, A, T: Iterator<A>> Iterator<A> for TakeWhile<'self, A, T> {
@@ -1544,7 +1544,7 @@ fn idx(&self, index: uint) -> Option<A> {
 /// An iterator to maintain state while iterating another iterator
 pub struct Scan<'self, A, B, T, St> {
     priv iter: T,
-    priv f: &'self fn(&mut St, A) -> Option<B>,
+    priv f: 'self |&mut St, A| -> Option<B>,
 
     /// The current internal state to be passed to the closure next.
     state: St
@@ -1568,7 +1568,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 ///
 pub struct FlatMap<'self, A, T, U> {
     priv iter: T,
-    priv f: &'self fn(A) -> U,
+    priv f: 'self |A| -> U,
     priv frontiter: Option<U>,
     priv backiter: Option<U>,
 }
@@ -1699,7 +1699,7 @@ fn reset_fuse(&mut self) {
 /// element before yielding it.
 pub struct Inspect<'self, A, T> {
     priv iter: T,
-    priv f: &'self fn(&A)
+    priv f: 'self |&A|
 }
 
 impl<'self, A, T> Inspect<'self, A, T> {
@@ -1751,7 +1751,7 @@ fn idx(&self, index: uint) -> Option<A> {
 
 /// An iterator which just modifies the contained state throughout iteration.
 pub struct Unfold<'self, A, St> {
-    priv f: &'self fn(&mut St) -> Option<A>,
+    priv f: 'self |&mut St| -> Option<A>,
     /// Internal state that will be yielded on the next iteration
     state: St
 }
@@ -1760,8 +1760,8 @@ impl<'self, A, St> Unfold<'self, A, St> {
     /// Creates a new iterator with the specified closure as the "iterator
     /// function" and an initial state to eventually pass to the iterator
     #[inline]
-    pub fn new<'a>(initial_state: St, f: &'a fn(&mut St) -> Option<A>)
-        -> Unfold<'a, A, St> {
+    pub fn new<'a>(initial_state: St, f: 'a |&mut St| -> Option<A>)
+               -> Unfold<'a, A, St> {
         Unfold {
             f: f,
             state: initial_state
index dfdb08b7550b93a8b68e8705d8a1b0a60aa1f555..247a7824a4465c7eb296fc00bef231e5630ba7c9 100644 (file)
@@ -205,12 +205,14 @@ fn ind_sample<R: Rng>(&self, rng: &mut R) -> T {
 // the perf improvement (25-50%) is definitely worth the extra code
 // size from force-inlining.
 #[inline(always)]
-fn ziggurat<R:Rng>(rng: &mut R,
-                   symmetric: bool,
-                   X: ziggurat_tables::ZigTable,
-                   F: ziggurat_tables::ZigTable,
-                   pdf: &'static fn(f64) -> f64,
-                   zero_case: &'static fn(&mut R, f64) -> f64) -> f64 {
+fn ziggurat<R:Rng>(
+            rng: &mut R,
+            symmetric: bool,
+            X: ziggurat_tables::ZigTable,
+            F: ziggurat_tables::ZigTable,
+            pdf: 'static |f64| -> f64,
+            zero_case: 'static |&mut R, f64| -> f64)
+            -> f64 {
     static SCALE: f64 = (1u64 << 53) as f64;
     loop {
         // reimplement the f64 generation as an optimisation suggested
index 3582782fc5ecdf1fea2f24e39f6e5a98f089e0da..11f552e73ae7ee407cd5a574b44dce80756413a2 100644 (file)
@@ -322,7 +322,7 @@ fn matches(&self, c: char) -> bool { *self == c }
     fn only_ascii(&self) -> bool { (*self as uint) < 128 }
 }
 
-impl<'self> CharEq for &'self fn(char) -> bool {
+impl<'self> CharEq for 'self |char| -> bool {
     #[inline]
     fn matches(&self, c: char) -> bool { (*self)(c) }
 
index 28b79bdd320b407286864d8af1993c14d6737006..ded7cd8df072bc632814b27639dd4d86e27b3914 100644 (file)
@@ -22,7 +22,7 @@
 use str::{Str, StrSlice};
 use vec::{Vector, ImmutableVector};
 
-pub type Cb<'self> = &'self fn(buf: &[u8]) -> bool;
+pub type Cb<'self> = 'self |buf: &[u8]| -> bool;
 
 ///
 /// A trait to implement in order to make a type hashable;
index 58504832b2d6922081f2e081b91bc4880a1f372b..226ce9ef6f2e631c4491cdbafa41a8a945c82db9 100644 (file)
@@ -44,7 +44,7 @@ fn finally(&self, dtor: ||) -> T {
     }
 }
 
-impl<'self,T> Finally<T> for &'self fn() -> T {
+impl<'self,T> Finally<T> for 'self || -> T {
     fn finally(&self, dtor: ||) -> T {
         let _d = Finallyalizer {
             dtor: dtor
@@ -57,7 +57,7 @@ fn finally(&self, dtor: ||) -> T {
 finally_fn!(extern "Rust" fn() -> T)
 
 struct Finallyalizer<'self> {
-    dtor: &'self fn()
+    dtor: 'self ||
 }
 
 #[unsafe_destructor]
index 5fbf03c3cbb94e0f532c81787ba1ecb5fa1d6da0..0b08f9d00faf9556dc7c8fa6ad0d97c44329820b 100644 (file)
@@ -222,7 +222,7 @@ pub fn build<A>(size: Option<uint>, builder: |push: |v: A||) -> ~[A] {
 pub struct SplitIterator<'self, T> {
     priv v: &'self [T],
     priv n: uint,
-    priv pred: &'self fn(t: &T) -> bool,
+    priv pred: 'self |t: &T| -> bool,
     priv finished: bool
 }
 
@@ -271,7 +271,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 pub struct RSplitIterator<'self, T> {
     priv v: &'self [T],
     priv n: uint,
-    priv pred: &'self fn(t: &T) -> bool,
+    priv pred: 'self |t: &T| -> bool,
     priv finished: bool
 }
 
@@ -859,20 +859,20 @@ pub trait ImmutableVector<'self, T> {
     fn rev_iter(self) -> RevIterator<'self, T>;
     /// Returns an iterator over the subslices of the vector which are
     /// separated by elements that match `pred`.
-    fn split(self, pred: &'self fn(&T) -> bool) -> SplitIterator<'self, T>;
+    fn split(self, pred: 'self |&T| -> bool) -> SplitIterator<'self, T>;
     /// Returns an iterator over the subslices of the vector which are
     /// separated by elements that match `pred`, limited to splitting
     /// at most `n` times.
-    fn splitn(self, n: uint, pred: &'self fn(&T) -> bool) -> SplitIterator<'self, T>;
+    fn splitn(self, n: uint, pred: |&T| -> bool) -> SplitIterator<'self, T>;
     /// Returns an iterator over the subslices of the vector which are
     /// separated by elements that match `pred`. This starts at the
     /// end of the vector and works backwards.
-    fn rsplit(self, pred: &'self fn(&T) -> bool) -> RSplitIterator<'self, T>;
+    fn rsplit(self, pred: |&T| -> bool) -> RSplitIterator<'self, T>;
     /// Returns an iterator over the subslices of the vector which are
     /// separated by elements that match `pred` limited to splitting
     /// at most `n` times. This starts at the end of the vector and
     /// works backwards.
-    fn rsplitn(self,  n: uint, pred: &'self fn(&T) -> bool) -> RSplitIterator<'self, T>;
+    fn rsplitn(self,  n: uint, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T>;
 
     /**
      * Returns an iterator over all contiguous windows of length
@@ -1024,12 +1024,12 @@ fn rev_iter(self) -> RevIterator<'self, T> {
     }
 
     #[inline]
-    fn split(self, pred: &'self fn(&T) -> bool) -> SplitIterator<'self, T> {
+    fn split(self, pred: 'self |&T| -> bool) -> SplitIterator<'self, T> {
         self.splitn(uint::max_value, pred)
     }
 
     #[inline]
-    fn splitn(self, n: uint, pred: &'self fn(&T) -> bool) -> SplitIterator<'self, T> {
+    fn splitn(self, n: uint, pred: 'self |&T| -> bool) -> SplitIterator<'self, T> {
         SplitIterator {
             v: self,
             n: n,
@@ -1039,12 +1039,12 @@ fn splitn(self, n: uint, pred: &'self fn(&T) -> bool) -> SplitIterator<'self, T>
     }
 
     #[inline]
-    fn rsplit(self, pred: &'self fn(&T) -> bool) -> RSplitIterator<'self, T> {
+    fn rsplit(self, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T> {
         self.rsplitn(uint::max_value, pred)
     }
 
     #[inline]
-    fn rsplitn(self, n: uint, pred: &'self fn(&T) -> bool) -> RSplitIterator<'self, T> {
+    fn rsplitn(self, n: uint, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T> {
         RSplitIterator {
             v: self,
             n: n,
index 16846823e0c6fe29f86c6edebbd28d829aa0d3f5..c14375604b1e2aaca64976ca0ff450eb08495e68 100644 (file)
@@ -669,7 +669,7 @@ pub trait EachViewItem {
 }
 
 struct EachViewItemData<'self> {
-    callback: &'self fn(&ast::view_item) -> bool,
+    callback: 'self |&ast::view_item| -> bool,
 }
 
 impl<'self> Visitor<()> for EachViewItemData<'self> {
index 23dc38fdc31e579414bb154bf36f7698562af9a5..2f6cfeb24da1f12ccf05fb500561d46d517c69ef 100644 (file)
@@ -294,7 +294,7 @@ pub enum SubstructureFields<'self> {
 all the fields of all the structures, see above for details.
 */
 pub type CombineSubstructureFunc<'self> =
-    &'self fn(@ExtCtxt, Span, &Substructure) -> @Expr;
+    'self |@ExtCtxt, Span, &Substructure| -> @Expr;
 
 /**
 Deal with non-matching enum variants, the arguments are a list
@@ -302,10 +302,11 @@ pub enum SubstructureFields<'self> {
 [variant fields]), and a list of the nonself args of the type
 */
 pub type EnumNonMatchFunc<'self> =
-    &'self fn(@ExtCtxt, Span,
-              &[(uint, ast::variant,
-                 ~[(Span, Option<Ident>, @Expr)])],
-              &[@Expr]) -> @Expr;
+    'self |@ExtCtxt,
+           Span,
+           &[(uint, ast::variant, ~[(Span, Option<Ident>, @Expr)])],
+           &[@Expr]|
+           -> @Expr;
 
 
 impl<'self> TraitDef<'self> {
index 3e65f7bdefbc51a22e0f840f934044beb0da1844..8729382141b8ad2d89491f8404674707dcdf7bf8 100644 (file)
 
 pub mod generic;
 
-pub type ExpandDerivingStructDefFn<'self> = &'self fn(@ExtCtxt,
-                                                       Span,
-                                                       x: &struct_def,
-                                                       Ident,
-                                                       y: &Generics)
-                                                 -> @item;
-pub type ExpandDerivingEnumDefFn<'self> = &'self fn(@ExtCtxt,
-                                                    Span,
-                                                    x: &enum_def,
-                                                    Ident,
-                                                    y: &Generics)
+pub type ExpandDerivingStructDefFn<'self> = 'self |@ExtCtxt,
+                                                   Span,
+                                                   x: &struct_def,
+                                                   Ident,
+                                                   y: &Generics|
+                                                   -> @item;
+pub type ExpandDerivingEnumDefFn<'self> = 'self |@ExtCtxt,
+                                                 Span,
+                                                 x: &enum_def,
+                                                 Ident,
+                                                 y: &Generics|
                                                  -> @item;
 
 pub fn expand_meta_deriving(cx: @ExtCtxt,
index a3ead83321f64a525b5bab01229910680018aff7..3855a348f60c0ee088563a17d354fc826be3bf0a 100644 (file)
@@ -13,7 +13,7 @@
 // part of issue-6919.rs
 
 struct C<'self> {
-    k: &'self fn(),
+    k: 'self ||,
 }
 
 fn no_op() { }
index e3fe631068c1f2c6b7dba621487b19670c6568e0..7621d5d7b087fe919ce4b22a19e71ae388ccec64 100644 (file)
 
 // returns an infinite iterator of repeated applications of f to x,
 // i.e. [x, f(x), f(f(x)), ...], as haskell iterate function.
-fn iterate<'a, T>(x: T, f: &'a fn(&T) -> T) -> Iterate<'a, T> {
+fn iterate<'a, T>(x: T, f: 'a |&T| -> T) -> Iterate<'a, T> {
     Iterate {f: f, next: x}
 }
 struct Iterate<'self, T> {
-    priv f: &'self fn(&T) -> T,
+    priv f: &'self |&T| -> T,
     priv next: T
 }
 impl<'self, T> Iterator<T> for Iterate<'self, T> {
index 032b2564f4fb2d5ea3b12d827bf6ff95cb96c8e9..4cfa543a93fbefc7527130a3895017f8484393e5 100644 (file)
@@ -10,7 +10,9 @@
 
 fn id<T>(t: T) -> T { t }
 
-fn f<'r, T>(v: &'r T) -> &'r fn()->T { id::<&'r fn()->T>(|| *v) } //~ ERROR cannot infer an appropriate lifetime
+fn f<'r, T>(v: &'r T) -> 'r || -> T {
+    id(|| *v) //~ ERROR cannot infer an appropriate lifetime
+}
 
 fn main() {
     let v = &5;
index 332db60c836fc3634615a483047842ca760f4a43..952a528b427ba09815a950fe58931f862d66b779 100644 (file)
@@ -10,7 +10,7 @@
 
 fn foopy() {}
 
-static f: &'static fn() = foopy; //~ ERROR found extern fn
+static f: 'static || = foopy; //~ ERROR found extern fn
 
 fn main () {
     f();
index db8effb1de3df0d6badac72a9ea9e2b470bb957d..bf7383f9c72b8c40aed227b6ea9a3c28f14d3c7a 100644 (file)
@@ -16,7 +16,7 @@ struct R<'self> {
     // This struct is needed to create the
     // otherwise infinite type of a fn that
     // accepts itself as argument:
-    c: &'self fn(&R, bool)
+    c: 'self |&R, bool|
 }
 
 fn innocent_looking_victim() {
index 251be9123597551d4f427d5251a2ac72dcb95f78..7e5abe8e2f7e44f3382a06425d2a6cd77dd5549d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn wants_static_fn(_x: &'static fn()) {}
+fn wants_static_fn(_x: 'static ||) {}
 
 fn main() {
     let i = 3;
index 3ddae976ce317409f9ebc6223f519e695baa02c1..6347fa97c4dd51ad4a0507658e7e51f256784375 100644 (file)
@@ -9,15 +9,15 @@
 // except according to those terms.
 
 struct parameterized1<'self> {
-    g: &'self fn()
+    g: 'self ||
 }
 
 struct not_parameterized1 {
-    g: &'static fn()
+    g: 'static ||
 }
 
 struct not_parameterized2 {
-    g: &'static fn()
+    g: 'static ||
 }
 
 fn take1(p: parameterized1) -> parameterized1 { p }
index 775164453e0d8472b439adba6d9af490a48bd6f0..c7364a60bdf9158f6cbbe965b96ccd0a0e36916e 100644 (file)
@@ -11,7 +11,7 @@
 #[feature(managed_boxes)];
 
 struct invariant<'self> {
-    f: &'static fn(x: @mut &'self int)
+    f: 'static |x: @mut &'self int|
 }
 
 fn to_same_lifetime<'r>(bi: invariant<'r>) {
index 44856d9e531e69020921eb6c39fa2b9593492cbf..8070d1f1dce7227b885964605787a4e27af1f6a8 100644 (file)
@@ -11,7 +11,7 @@
 #[feature(managed_boxes)];
 
 struct invariant<'self> {
-    f: &'static fn() -> @mut &'self int
+    f: 'static || -> @mut &'self int
 }
 
 fn to_same_lifetime<'r>(bi: invariant<'r>) {
index 47c1f7a5757dea49dcf1a0bc0ef2caf7504401fd..92159489ae70702aef0b894ca35538853d6eabf7 100644 (file)
@@ -14,12 +14,12 @@ struct direct<'self> {
 
 struct indirect1 {
     // Here the lifetime parameter of direct is bound by the fn()
-    g: &'static fn(direct)
+    g: 'static |direct|
 }
 
 struct indirect2<'self> {
     // But here it is set to 'self
-    g: &'static fn(direct<'self>)
+    g: 'static |direct<'self>|
 }
 
 fn take_direct(p: direct) -> direct { p } //~ ERROR mismatched types
index be034eda67dcf2b05d2e6932ab569cc019e80358..292e282dd073e1c998ad43306886ab5ccb066d2a 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 struct closure_box<'self> {
-    cl: &'self fn()
+    cl: 'self ||
 }
 
-fn box_it<'r>(x: &'r fn()) -> closure_box<'r> {
+fn box_it<'r>(x: 'r ||) -> closure_box<'r> {
     closure_box {cl: x}
 }
 
index bd415e9eac3e73eb9223ac84c987df0c4841afbd..ee570fa2e950def1c5790290732744010c9cfc01 100644 (file)
@@ -16,7 +16,7 @@ fn main() {
     let cheese = ~"roquefort";
     let carrots = @~"crunchy";
 
-    let result: &'static fn(@~str, |~str|) = (|tasties, macerate| {
+    let result: 'static |@~str, |~str|| = (|tasties, macerate| {
         macerate((*tasties).clone());
     });
     result(carrots, |food| {
index dfcfb30f77ffbbb772325ed00881a825222f80de..126d53621dd7b77400d43eed6af445871007c02a 100644 (file)
@@ -12,7 +12,7 @@ fn foo() -> int {
     return 0xca7f000d;
 }
 
-struct Bar<'self> { f: &'self fn() -> int }
+struct Bar<'self> { f: 'self || -> int }
 
 static b : Bar<'static> = Bar { f: foo };
 
index 6117ea962afac84b2a34d895c6c7f114b6d8013c..593d0e3125d6705adbb0b6b1072f1d32a6051e29 100644 (file)
@@ -20,7 +20,7 @@
 
 fn f() { }
 static bare_fns: &'static [extern fn()] = &[f, f];
-struct S<'self>(&'self fn());
+struct S<'self>('self ||);
 static closures: &'static [S<'static>] = &[S(f), S(f)];
 
 pub fn main() {
index 63e5c7688d345a38150a67c4753290ea546a1459..e18509252235de514e832233a7a8d2943535ccfe 100644 (file)
@@ -11,7 +11,7 @@
 
 
 fn test_fn() {
-    type t = &'static fn() -> int;
+    type t = 'static || -> int;
     fn ten() -> int { return 10; }
     let rs: t = { ten };
     assert!((rs() == 10));
index 04c96bb2b980489a132dd990d3c7c5d69aaaa753..f081d13a5b0b13eb330982a08d8e018a70b96f51 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-type compare<T> = &'static fn(@T, @T) -> bool;
+type compare<T> = 'static |@T, @T| -> bool;
 
 fn test_generic<T>(expected: @T, eq: compare<T>) {
     let actual: @T = { expected };
index 562c3c1e523032edb249b734dc4bdb3c9d44f69a..04721c6bd94ec9c0e13f8f7f300672657df0d8a1 100644 (file)
@@ -12,7 +12,7 @@
 
 // xfail-fast
 
-type compare<'self, T> = &'self fn(T, T) -> bool;
+type compare<'self, T> = 'self |T, T| -> bool;
 
 fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
     let actual: T = { expected.clone() };
index 159c2bfb8eff463cd6141d4e5d23a469567cb828..f1df0e167b9a10452bae66e24d7b3007df2597c5 100644 (file)
@@ -10,7 +10,7 @@
 
 
 
-type compare<'self, T> = &'self fn(~T, ~T) -> bool;
+type compare<'self, T> = 'self |~T, ~T| -> bool;
 
 fn test_generic<T:Clone>(expected: ~T, eq: compare<T>) {
     let actual: ~T = { expected.clone() };
index ff811a9f458f3aef787d5f520821da06c84c9096..b666a2f6760e61afde1a76b6278b1283ef34f4cd 100644 (file)
@@ -10,7 +10,7 @@
 
 // xfail-fast
 
-type compare<'self, T> = &'self fn(T, T) -> bool;
+type compare<'self, T> = 'self |T, T| -> bool;
 
 fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
     let actual: T = { expected.clone() };
index 800f22169d3d4db5ec91f53f29b01a8b0d63cb57..bc8c4c8983d964cbe22a8725047b674243e9cb86 100644 (file)
@@ -12,7 +12,7 @@
 // xfail-fast
 
 // Tests for standalone blocks as expressions with dynamic type sizes
-type compare<'self, T> = &'self fn(T, T) -> bool;
+type compare<'self, T> = 'self |T, T| -> bool;
 
 fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
     let actual: T = { expected.clone() };
index e6039d0601e38d47055c7503c69f0bcb2ffb5aab..cba01fbd8dd819a917e8e9dc380c2308d2b7171a 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-type compare<T> = &'static fn(@T, @T) -> bool;
+type compare<T> = 'static |@T, @T| -> bool;
 
 fn test_generic<T>(expected: @T, not_expected: @T, eq: compare<T>) {
     let actual: @T = if true { expected } else { not_expected };
index b8d872742ab61afa94fe6bde083f0dd44f25097a..5ef97832221bfcd094f2e52f86ac4e1b9d8e3fda 100644 (file)
@@ -12,7 +12,7 @@
 
 // xfail-fast
 
-type compare<T> = &'static fn(T, T) -> bool;
+type compare<T> = 'static |T, T| -> bool;
 
 fn test_generic<T:Clone>(expected: T, not_expected: T, eq: compare<T>) {
     let actual: T = if true { expected.clone() } else { not_expected };
index 8e6e3f7ddda85d83c98a41f12e1ef909b3895719..bd1a550e205fcab5db8eb50284e23a51383f502d 100644 (file)
@@ -11,7 +11,7 @@
 // xfail-fast
 
 // Tests for if as expressions with dynamic type sizes
-type compare<T> = &'static fn(T, T) -> bool;
+type compare<T> = 'static |T, T| -> bool;
 
 fn test_generic<T:Clone>(expected: T, not_expected: T, eq: compare<T>) {
     let actual: T = if true { expected.clone() } else { not_expected };
index 9220b0d697a8e59f94755b8694e1a54a8b0a7b80..82e80e7da7dc3ac3256aeee7efe3c1e3e6a22577 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-type compare<T> = &'static fn(@T, @T) -> bool;
+type compare<T> = 'static |@T, @T| -> bool;
 
 fn test_generic<T>(expected: @T, eq: compare<T>) {
     let actual: @T = match true { true => { expected }, _ => fail!() };
index 430bd0f52c313a98cca2d2e78af6362ba61a5f57..8fed749e3022e0b5a92fb8a3a0f271b88c4cc67f 100644 (file)
@@ -12,7 +12,7 @@
 
 // xfail-fast
 
-type compare<T> = &'static fn(T, T) -> bool;
+type compare<T> = 'static |T, T| -> bool;
 
 fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
     let actual: T = match true { true => { expected.clone() }, _ => fail!("wat") };
index b4bc7d3bef6971ddaa17d68a954a688b3f3ab226..af9022ed3222ce3ef1194566b4073fbe8366b336 100644 (file)
@@ -10,7 +10,7 @@
 
 
 
-type compare<T> = &'static fn(~T, ~T) -> bool;
+type compare<T> = 'static |~T, ~T| -> bool;
 
 fn test_generic<T:Clone>(expected: ~T, eq: compare<T>) {
     let actual: ~T = match true {
index 8eb5861f71ee71898eaebb7e0bdb8bf41e08405c..2bd0f18ba0a7462c804644d5a8fda3996028446a 100644 (file)
@@ -10,7 +10,7 @@
 
 // xfail-fast
 
-type compare<'self, T> = &'self fn(T, T) -> bool;
+type compare<'self, T> = 'self |T, T| -> bool;
 
 fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
     let actual: T = match true {
index ae2e353f913ba5631ece94819717d0c14250a9a1..809005258b51a5c3d93174f20590924b1bf18ac3 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct r<'self> {
-    field: &'self fn()
+    field: 'self ||
 }
 
 pub fn main() {
index 73595fd782c4744fefae61462929d7dfd841b72f..1716f882dd86e6fcc3b913fcd895fd401490065b 100644 (file)
@@ -24,7 +24,7 @@ mod map_reduce {
     use std::str;
     use std::task;
 
-    pub type putter<'self> = &'self fn(~str, ~str);
+    pub type putter<'self> = 'self |~str, ~str|;
 
     pub type mapper = extern fn(~str, putter);
 
index 4b73d83595e64c6c2ac33d71c8c46b8e75c0360f..f3ffed7dc7bc3b78f05937d407b54d6d6ae68c29 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 pub fn main() {
-    let early_error: &'static fn(&str) -> !  = |_msg| { fail!() };
+    let early_error: 'static |&str| -> ! = |_msg| { fail!() };
 }
index afe7656b7a343756876bb2d4ba7d2ccba0ebf2a2..9ebeec092cf15876b2f08fca0b2c9e2cc03a0594 100644 (file)
@@ -18,7 +18,7 @@
 //
 // Running /usr/local/bin/rustc:
 // issue-2185.rs:24:0: 26:1 error: conflicting implementations for a trait
-// issue-2185.rs:24 impl iterable<uint> for &'static fn(|uint|) {
+// issue-2185.rs:24 impl iterable<uint> for 'static ||uint|| {
 // issue-2185.rs:25     fn iter(&self, blk: |v: uint|) { self( |i| blk(i) ) }
 // issue-2185.rs:26 }
 // issue-2185.rs:20:0: 22:1 note: note conflicting implementation here
index cb1ffc389089808ca828cb83c859c636b5813363..8179d85e601f3f9155fbdaf0da97093864462454 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type Connection = &'static fn(~[u8]);
+type Connection = 'static |~[u8]|;
 
 fn f() -> Option<Connection> {
     let mock_connection: Connection = |_| {};
index d014a3cf1a15cf4d1b4ed4e4aa8feaa86d903b89..b72ef59075ce228738cec7a31f8dd2218ca71ce7 100644 (file)
 
 struct A { a: ~int }
 
-fn foo() -> &'static fn() -> int {
+fn foo() -> 'static || -> int {
     let k = ~22;
     let _u = A {a: k.clone()};
-    let result: &'static fn() -> int = || 22;
+    let result: 'static || -> int = || 22;
     result
 }
 
index 0b962731ecf3ca15e46d00493cc51a65e68c7553..19fd120641997a05a979eaff5770a1f5b0a56de5 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 struct closure_box<'self> {
-    cl: &'self fn(),
+    cl: 'self ||,
 }
 
-fn box_it<'r>(x: &'r fn()) -> closure_box<'r> {
+fn box_it<'r>(x: 'r ||) -> closure_box<'r> {
     closure_box {cl: x}
 }
 
index bce2159cc7b9ffa314b78f28d72b517112926428..b50930dd2947b028bb820ceac58f48af0b60328f 100644 (file)
@@ -11,9 +11,9 @@
 // Test lifetimes are linked properly when we autoslice a vector.
 // Issue #3148.
 
-fn subslice<'r>(v: &'r fn()) -> &'r fn() { v }
+fn subslice<'r>(v: 'r ||) -> 'r || { v }
 
-fn both<'r>(v: &'r fn()) -> &'r fn() {
+fn both<'r>(v: 'r ||) -> 'r || {
     subslice(subslice(v))
 }
 
index a2eb459ce206ed575f8d535be41f65e2d7ffd49e..941f2c5edfda0fffaf1860a447cc49722b63a79d 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 struct closure_box<'self> {
-    cl: &'self fn(),
+    cl: 'self ||,
 }
 
-fn box_it<'r>(x: &'r fn()) -> closure_box<'r> {
+fn box_it<'r>(x: 'r ||) -> closure_box<'r> {
     closure_box {cl: x}
 }