about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-03-01 12:11:07 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-03-02 16:49:31 -0800
commit97fd421319fda45d0d4c6a0906f29a228ec57b42 (patch)
treee906561c9b457d86bd54142c8a2a79ec44ded0bd
parenta3f728238bb49759a3b3b64599808c3265f2caca (diff)
downloadrust-97fd421319fda45d0d4c6a0906f29a228ec57b42.tar.gz
rust-97fd421319fda45d0d4c6a0906f29a228ec57b42.zip
librustc: Remove `fn@`, `fn~`, and `fn&` from librustc. rs=defun
-rw-r--r--src/libcore/core.rc3
-rw-r--r--src/librustc/front/config.rs2
-rw-r--r--src/librustc/front/test.rs2
-rw-r--r--src/librustc/metadata/encoder.rs2
-rw-r--r--src/librustc/metadata/tydecode.rs2
-rw-r--r--src/librustc/metadata/tyencode.rs4
-rw-r--r--src/librustc/middle/astencode.rs2
-rw-r--r--src/librustc/middle/borrowck/gather_loans.rs2
-rw-r--r--src/librustc/middle/freevars.rs10
-rw-r--r--src/librustc/middle/kind.rs4
-rw-r--r--src/librustc/middle/trans/_match.rs2
-rw-r--r--src/librustc/middle/trans/base.rs4
-rw-r--r--src/librustc/middle/trans/closure.rs15
-rw-r--r--src/librustc/middle/trans/common.rs22
-rw-r--r--src/librustc/middle/trans/glue.rs2
-rw-r--r--src/librustc/middle/trans/tvec.rs4
-rw-r--r--src/librustc/middle/ty.rs6
-rw-r--r--src/librustc/middle/typeck/check/mod.rs10
-rw-r--r--src/librustc/rustc.rc8
-rw-r--r--src/librustc/util/common.rs4
20 files changed, 58 insertions, 52 deletions
diff --git a/src/libcore/core.rc b/src/libcore/core.rc
index 56a18024ac9..19042195573 100644
--- a/src/libcore/core.rc
+++ b/src/libcore/core.rc
@@ -253,9 +253,8 @@ pub mod core {
 
     pub use cmp;
     pub use condition;
-    pub use kinds;
-    pub use ops;
     pub use option;
+    pub use kinds;
     pub use sys;
     pub use pipes;
 }
diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs
index faa1ad9854a..cdf63c49de3 100644
--- a/src/librustc/front/config.rs
+++ b/src/librustc/front/config.rs
@@ -15,7 +15,7 @@ use syntax::{ast, fold, attr};
 use core::option;
 use core::vec;
 
-type in_cfg_pred = fn@(+attrs: ~[ast::attribute]) -> bool;
+type in_cfg_pred = @fn(+attrs: ~[ast::attribute]) -> bool;
 
 struct Context {
     in_cfg: in_cfg_pred
diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs
index c17a861165a..524e46db738 100644
--- a/src/librustc/front/test.rs
+++ b/src/librustc/front/test.rs
@@ -29,7 +29,7 @@ use syntax::fold;
 use syntax::print::pprust;
 use syntax::{ast, ast_util};
 
-type node_id_gen = fn@() -> ast::node_id;
+type node_id_gen = @fn() -> ast::node_id;
 
 struct Test {
     span: span,
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 7d2423c7c5d..403cc1cf978 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -57,7 +57,7 @@ use writer = std::ebml::writer;
 // used by astencode:
 type abbrev_map = oldmap::HashMap<ty::t, tyencode::ty_abbrev>;
 
-pub type encode_inlined_item = fn@(ecx: @EncodeContext,
+pub type encode_inlined_item = @fn(ecx: @EncodeContext,
                                    ebml_w: writer::Encoder,
                                    path: &[ast_map::path_elt],
                                    ii: ast::inlined_item);
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index 8da6ddda4b3..233c0949fa6 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -81,7 +81,7 @@ pub fn parse_ident(st: @mut PState, last: char) -> ast::ident {
     return parse_ident_(st, |a| is_last(last, a) );
 }
 
-fn parse_ident_(st: @mut PState, is_last: fn@(char) -> bool) ->
+fn parse_ident_(st: @mut PState, is_last: @fn(char) -> bool) ->
    ast::ident {
     let mut rslt = ~"";
     while !is_last(peek(st)) {
diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs
index dccbf7c778e..8fd1d176b65 100644
--- a/src/librustc/metadata/tyencode.rs
+++ b/src/librustc/metadata/tyencode.rs
@@ -29,10 +29,10 @@ use middle::ty::Vid;
 pub struct ctxt {
     diag: span_handler,
     // Def -> str Callback:
-    ds: fn@(def_id) -> ~str,
+    ds: @fn(def_id) -> ~str,
     // The type context.
     tcx: ty::ctxt,
-    reachable: fn@(node_id) -> bool,
+    reachable: @fn(node_id) -> bool,
     abbrevs: abbrev_ctxt
 }
 
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index d5cb2f8726d..b52a2d0bb09 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -843,7 +843,7 @@ fn encode_side_tables_for_ii(ecx: @e::EncodeContext,
         let ebml_w = copy ebml_w;
         ast_util::visit_ids_for_inlined_item(
             ii,
-            fn@(id: ast::node_id) {
+            |id: ast::node_id| {
                 // Note: this will cause a copy of ebml_w, which is bad as
                 // it has mut fields.  But I believe it's harmless since
                 // we generate balanced EBML.
diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs
index ab343456ef4..457701e659a 100644
--- a/src/librustc/middle/borrowck/gather_loans.rs
+++ b/src/librustc/middle/borrowck/gather_loans.rs
@@ -251,7 +251,7 @@ fn req_loans_in_expr(ex: @ast::expr,
         // Receivers in method calls are always passed by ref.
         //
         // Here, the field a.b is in fact a closure.  Eventually, this
-        // should be an fn&, but for now it's an fn@.  In any case,
+        // should be an &fn, but for now it's an @fn.  In any case,
         // the enclosing scope is either the call where it is a rcvr
         // (if used like `a.b(...)`), the call where it's an argument
         // (if used like `x(a.b)`), or the block (if used like `let x
diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs
index 7d2ab1700dd..f26d5c7d11c 100644
--- a/src/librustc/middle/freevars.rs
+++ b/src/librustc/middle/freevars.rs
@@ -46,7 +46,8 @@ fn collect_freevars(def_map: resolve::DefMap, blk: &ast::blk)
 
     fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
 
-    let walk_expr = fn@(expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
+    let walk_expr: @fn(expr: @ast::expr, &&depth: int, v: visit::vt<int>) =
+        |expr, depth, v| {
             match expr.node {
               ast::expr_fn(_, _, _, _) => {
                 visit::visit_expr(expr, depth + 1, v);
@@ -100,8 +101,11 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: @ast::crate) ->
    freevar_map {
     let freevars = HashMap();
 
-    let walk_fn = fn@(_fk: &visit::fn_kind, _decl: &ast::fn_decl,
-                      blk: &ast::blk, _sp: span, nid: ast::node_id) {
+    let walk_fn: @fn(&visit::fn_kind,
+                     &ast::fn_decl,
+                     &ast::blk,
+                     span,
+                     ast::node_id) = |_, _, blk, _, nid| {
         let vars = collect_freevars(def_map, blk);
         freevars.insert(nid, vars);
     };
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index 355ec5bf9e5..aca5675aa15 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -84,7 +84,7 @@ pub fn check_crate(tcx: ty::ctxt,
         visit_expr: check_expr,
         visit_fn: check_fn,
         visit_ty: check_ty,
-        visit_item: fn@(i: @item, cx: Context, v: visit::vt<Context>) {
+        visit_item: |i, cx, v| {
             visit::visit_item(i, Context { current_item: i.id,.. cx }, v);
         },
         .. *visit::default_visitor()
@@ -93,7 +93,7 @@ pub fn check_crate(tcx: ty::ctxt,
     tcx.sess.abort_if_errors();
 }
 
-type check_fn = fn@(Context, @freevar_entry);
+type check_fn = @fn(Context, @freevar_entry);
 
 // Yields the appropriate function to check the kind of closed over
 // variables. `id` is the node_id for some expression that creates the
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index 2f920378087..0d3524ed7fb 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -1003,7 +1003,7 @@ pub fn any_tuple_struct_pat(bcx: block, m: &[@Match], col: uint) -> bool {
     })
 }
 
-pub type mk_fail = fn@() -> BasicBlockRef;
+pub type mk_fail = @fn() -> BasicBlockRef;
 
 pub fn pick_col(m: &[@Match]) -> uint {
     fn score(p: @ast::pat) -> uint {
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index d1472f63ae7..a714446235a 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -634,8 +634,8 @@ pub fn compare_scalar_values(cx: block,
     }
 }
 
-pub type val_pair_fn = fn@(block, ValueRef, ValueRef) -> block;
-pub type val_and_ty_fn = fn@(block, ValueRef, ty::t) -> block;
+pub type val_pair_fn = @fn(block, ValueRef, ValueRef) -> block;
+pub type val_and_ty_fn = @fn(block, ValueRef, ty::t) -> block;
 
 pub fn load_inbounds(cx: block, p: ValueRef, idxs: &[uint]) -> ValueRef {
     return Load(cx, GEPi(cx, p, idxs));
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index 949318d1723..fd149aa71e5 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -42,7 +42,7 @@ use syntax::print::pprust::expr_to_str;
 // roughly as follows:
 //
 // struct rust_opaque_box {         // see rust_internal.h
-//   unsigned ref_count;            // only used for fn@()
+//   unsigned ref_count;            // only used for @fn()
 //   type_desc *tydesc;             // describes closure_data struct
 //   rust_opaque_box *prev;         // (used internally by memory alloc)
 //   rust_opaque_box *next;         // (used internally by memory alloc)
@@ -57,7 +57,7 @@ use syntax::print::pprust::expr_to_str;
 // };
 //
 // Note that the closure is itself a rust_opaque_box.  This is true
-// even for fn~ and fn&, because we wish to keep binary compatibility
+// even for ~fn and &fn, because we wish to keep binary compatibility
 // between all kinds of closures.  The allocation strategy for this
 // closure depends on the closure type.  For a sendfn, the closure
 // (and the referenced type descriptors) will be allocated in the
@@ -440,11 +440,10 @@ pub fn trans_expr_fn(bcx: block,
 }
 
 pub fn make_closure_glue(
-    cx: block,
-    v: ValueRef,
-    t: ty::t,
-    glue_fn: fn@(block, v: ValueRef, t: ty::t) -> block) -> block
-{
+        cx: block,
+        v: ValueRef,
+        t: ty::t,
+        glue_fn: @fn(block, v: ValueRef, t: ty::t) -> block) -> block {
     let _icx = cx.insn_ctxt("closure::make_closure_glue");
     let bcx = cx;
     let tcx = cx.tcx();
@@ -483,7 +482,7 @@ pub fn make_opaque_cbox_take_glue(
         }
     }
 
-    // fn~ requires a deep copy.
+    // ~fn requires a deep copy.
     let ccx = bcx.ccx(), tcx = ccx.tcx;
     let llopaquecboxty = T_opaque_box_ptr(ccx);
     let cbox_in = Load(bcx, cboxptr);
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index c2a7abe747b..bd8bbfce5a4 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -61,14 +61,15 @@ use syntax::parse::token::ident_interner;
 use syntax::print::pprust::expr_to_str;
 use syntax::{ast, ast_map};
 
-pub type namegen = fn@(~str) -> ident;
+pub type namegen = @fn(~str) -> ident;
 pub fn new_namegen(intr: @ident_interner) -> namegen {
-    return fn@(prefix: ~str) -> ident {
+    let f: @fn(~str) -> ident = |prefix| {
         // XXX: Bad copies.
-        return intr.gensym(@fmt!("%s_%u",
-                                 prefix,
-                                 intr.gensym(@copy prefix).repr))
+        intr.gensym(@fmt!("%s_%u",
+                          prefix,
+                          intr.gensym(@copy prefix).repr))
     };
+    f
 }
 
 pub type addrspace = c_uint;
@@ -81,10 +82,11 @@ pub type addrspace = c_uint;
 pub const default_addrspace: addrspace = 0;
 pub const gc_box_addrspace: addrspace = 1;
 
-pub type addrspace_gen = fn@() -> addrspace;
+pub type addrspace_gen = @fn() -> addrspace;
 pub fn new_addrspace_gen() -> addrspace_gen {
     let i = @mut 1;
-    return fn@() -> addrspace { *i += 1; *i };
+    let result: addrspace_gen = || { *i += 1; *i };
+    result
 }
 
 pub struct tydesc_info {
@@ -349,8 +351,8 @@ pub enum cleantype {
 }
 
 pub enum cleanup {
-    clean(fn@(block) -> block, cleantype),
-    clean_temp(ValueRef, fn@(block) -> block, cleantype),
+    clean(@fn(block) -> block, cleantype),
+    clean_temp(ValueRef, @fn(block) -> block, cleantype),
 }
 
 // Used to remember and reuse existing cleanup paths
@@ -1034,7 +1036,7 @@ pub fn T_typaram_ptr(tn: @TypeNames) -> TypeRef {
 }
 
 pub fn T_opaque_cbox_ptr(cx: @CrateContext) -> TypeRef {
-    // closures look like boxes (even when they are fn~ or fn&)
+    // closures look like boxes (even when they are ~fn or &fn)
     // see trans_closure.rs
     return T_opaque_box_ptr(cx);
 }
diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs
index 96deb2906eb..de6d22cd6b8 100644
--- a/src/librustc/middle/trans/glue.rs
+++ b/src/librustc/middle/trans/glue.rs
@@ -709,7 +709,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
     return inf;
 }
 
-pub type glue_helper = fn@(block, ValueRef, ty::t);
+pub type glue_helper = @fn(block, ValueRef, ty::t);
 
 pub fn declare_generic_glue(ccx: @CrateContext, t: ty::t, llfnty: TypeRef,
                             +name: ~str) -> ValueRef {
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index 9e9b9da369a..3542b5acf05 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -520,9 +520,9 @@ pub fn get_base_and_len(bcx: block,
     }
 }
 
-pub type val_and_ty_fn = fn@(block, ValueRef, ty::t) -> Result;
+pub type val_and_ty_fn = @fn(block, ValueRef, ty::t) -> Result;
 
-pub type iter_vec_block = fn(block, ValueRef, ty::t) -> block;
+pub type iter_vec_block = &fn(block, ValueRef, ty::t) -> block;
 
 pub fn iter_vec_raw(bcx: block, data_ptr: ValueRef, vec_ty: ty::t,
                     fill: ValueRef, f: iter_vec_block) -> block {
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index a18bba7f3f2..7acc1348613 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -525,7 +525,7 @@ pub enum sty {
     // "Fake" types, used for trans purposes
     ty_type, // type_desc*
     ty_opaque_box, // used by monomorphizer to represent any @ box
-    ty_opaque_closure_ptr(Sigil), // ptr to env for fn, fn@, fn~
+    ty_opaque_closure_ptr(Sigil), // ptr to env for &fn, @fn, ~fn
     ty_unboxed_vec(mt),
 }
 
@@ -1102,8 +1102,8 @@ pub pure fn mach_sty(cfg: @session::config, t: t) -> sty {
 }
 
 pub fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
-        // FIXME(#2202) --- We retain by-ref for fn& things to workaround a
-        // memory leak that otherwise results when @fn is upcast to &fn.
+    // FIXME(#2202) --- We retain by-ref for &fn things to workaround a
+    // memory leak that otherwise results when @fn is upcast to &fn.
     match ty::get(ty).sty {
         ty::ty_closure(ClosureTy {sigil: ast::BorrowedSigil, _}) => {
             return ast::by_ref;
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 570793e1b43..a20eee8f981 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -389,7 +389,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
                      self_info: Option<SelfInfo>) {
         let tcx = fcx.ccx.tcx;
 
-        let assign = fn@(nid: ast::node_id, ty_opt: Option<ty::t>) {
+        let assign: @fn(ast::node_id, Option<ty::t>) = |nid, ty_opt| {
             match ty_opt {
                 None => {
                     // infer the variable's type
@@ -432,8 +432,8 @@ pub fn check_fn(ccx: @mut CrateCtxt,
         }
 
         // Add explicitly-declared locals.
-        let visit_local = fn@(local: @ast::local,
-                              &&e: (), v: visit::vt<()>) {
+        let visit_local: @fn(@ast::local, &&e: (), visit::vt<()>) =
+                |local, e, v| {
             let o_ty = match local.node.ty.node {
               ast::ty_infer => None,
               _ => Some(fcx.to_ty(local.node.ty))
@@ -447,7 +447,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
         };
 
         // Add pattern bindings.
-        let visit_pat = fn@(p: @ast::pat, &&e: (), v: visit::vt<()>) {
+        let visit_pat: @fn(@ast::pat, &&e: (), visit::vt<()>) = |p, e, v| {
             match p.node {
               ast::pat_ident(_, path, _)
                   if pat_util::pat_is_binding(fcx.ccx.tcx.def_map, p) => {
@@ -462,7 +462,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
             visit::visit_pat(p, e, v);
         };
 
-        let visit_block = fn@(b: &ast::blk, &&e: (), v: visit::vt<()>) {
+        let visit_block: @fn(&ast::blk, &&e: (), visit::vt<()>) = |b, e, v| {
             // non-obvious: the `blk` variable maps to region lb, so
             // we have to keep this up-to-date.  This
             // is... unfortunate.  It'd be nice to not need this.
diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc
index ed6b84b098e..8ab6a07a910 100644
--- a/src/librustc/rustc.rc
+++ b/src/librustc/rustc.rc
@@ -315,7 +315,7 @@ diagnostic emitter which records when we hit a fatal error. If the task
 fails without recording a fatal error then we've encountered a compiler
 bug and need to present an error.
 */
-pub fn monitor(+f: fn~(diagnostic::Emitter)) {
+pub fn monitor(+f: ~fn(diagnostic::Emitter)) {
     use core::cell::Cell;
     use core::comm::*;
     let (p, ch) = stream();
@@ -326,8 +326,10 @@ pub fn monitor(+f: fn~(diagnostic::Emitter)) {
         let ch_capture = ch.clone();
         // The 'diagnostics emitter'. Every error, warning, etc. should
         // go through this function.
-        let demitter = fn@(cmsp: Option<(@codemap::CodeMap, codemap::span)>,
-                           msg: &str, lvl: diagnostic::level) {
+        let demitter: @fn(Option<(@codemap::CodeMap, codemap::span)>,
+                          &str,
+                          diagnostic::level) =
+                          |cmsp, msg, lvl| {
             if lvl == diagnostic::fatal {
                 ch_capture.send(fatal);
             }
diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs
index 6357198fdf2..8729ca5f6e1 100644
--- a/src/librustc/util/common.rs
+++ b/src/librustc/util/common.rs
@@ -59,7 +59,7 @@ pub fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] {
 
 // Takes a predicate p, returns true iff p is true for any subexpressions
 // of b -- skipping any inner loops (loop, while, loop_body)
-pub fn loop_query(b: &ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
+pub fn loop_query(b: &ast::blk, p: @fn(ast::expr_) -> bool) -> bool {
     let rs = @mut false;
     let visit_expr: @fn(@ast::expr,
                         &&flag: @mut bool,
@@ -82,7 +82,7 @@ pub fn loop_query(b: &ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
 
 // Takes a predicate p, returns true iff p is true for any subexpressions
 // of b -- skipping any inner loops (loop, while, loop_body)
-pub fn block_query(b: &ast::blk, p: fn@(@ast::expr) -> bool) -> bool {
+pub fn block_query(b: &ast::blk, p: @fn(@ast::expr) -> bool) -> bool {
     let rs = @mut false;
     let visit_expr: @fn(@ast::expr,
                         &&flag: @mut bool,