about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-08-03 19:49:12 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-08-03 19:49:12 -0700
commitf23674394f2e77b7aa4686a5ae9f2f60d6faa428 (patch)
tree4c4d8d805f80254a9aa2f2788d288e053d88fe62
parent51a5a4ad0e2501b260a8059a72e4b0eebe78d6f9 (diff)
downloadrust-f23674394f2e77b7aa4686a5ae9f2f60d6faa428.tar.gz
rust-f23674394f2e77b7aa4686a5ae9f2f60d6faa428.zip
rustc: Merge fn& and fn in favor of fn&.
This is a step on the way to moving the function "proto" sigil out front.
-rw-r--r--src/libsyntax/ast.rs3
-rw-r--r--src/libsyntax/ext/auto_serialize.rs8
-rw-r--r--src/libsyntax/parse/parser.rs19
-rw-r--r--src/libsyntax/print/pprust.rs1
-rw-r--r--src/rustc/metadata/tydecode.rs1
-rw-r--r--src/rustc/metadata/tyencode.rs1
-rw-r--r--src/rustc/middle/borrowck/categorization.rs2
-rw-r--r--src/rustc/middle/borrowck/check_loans.rs2
-rw-r--r--src/rustc/middle/capture.rs2
-rw-r--r--src/rustc/middle/kind.rs2
-rw-r--r--src/rustc/middle/trans/closure.rs5
-rw-r--r--src/rustc/middle/trans/foreign.rs2
-rw-r--r--src/rustc/middle/trans/reflect.rs1
-rw-r--r--src/rustc/middle/trans/shape.rs3
-rw-r--r--src/rustc/middle/trans/type_use.rs2
-rw-r--r--src/rustc/middle/ty.rs3
-rw-r--r--src/rustc/middle/typeck/check.rs2
-rw-r--r--src/rustc/middle/typeck/collect.rs4
-rw-r--r--src/rustc/middle/typeck/infer.rs6
-rw-r--r--src/test/compile-fail/block-coerce-no.rs2
-rw-r--r--src/test/compile-fail/extern-wrong-value-type.rs4
-rw-r--r--src/test/compile-fail/missing-do.rs2
22 files changed, 33 insertions, 44 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index cc06049bd45..27cd21d1d9f 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -178,7 +178,6 @@ enum mutability { m_mutbl, m_imm, m_const, }
 #[auto_serialize]
 enum proto {
     proto_bare,    // foreign fn
-    proto_any,     // fn
     proto_uniq,    // fn~
     proto_box,     // fn@
     proto_block,   // fn&
@@ -195,7 +194,7 @@ enum vstore {
 
 pure fn is_blockish(p: ast::proto) -> bool {
     alt p {
-      proto_any | proto_block { true }
+      proto_block { true }
       proto_bare | proto_uniq | proto_box { false }
     }
 }
diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs
index 90319feb4d2..cc37b5cc8d0 100644
--- a/src/libsyntax/ext/auto_serialize.rs
+++ b/src/libsyntax/ext/auto_serialize.rs
@@ -186,10 +186,10 @@ impl helpers of ext_ctxt_helpers for ext_ctxt {
         };
 
         @{id: self.next_id(),
-          node: ast::ty_fn(ast::proto_any, {inputs: args,
-                                            output: output,
-                                            purity: ast::impure_fn,
-                                            cf: ast::return_val}),
+          node: ast::ty_fn(ast::proto_block, {inputs: args,
+                                              output: output,
+                                              purity: ast::impure_fn,
+                                              cf: ast::return_val}),
           span: span}
     }
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c76a82a5c9b..4769e4ab384 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -41,13 +41,13 @@ import ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute,
              match_nonterminal, match_seq, match_tok, method, mode, mt, mul,
              mutability, neg, noreturn, not, pat, pat_box, pat_enum,
              pat_ident, pat_lit, pat_range, pat_rec, pat_tup, pat_uniq,
-             pat_wild, path, private, proto, proto_any, proto_bare,
-             proto_block, proto_box, proto_uniq, provided, public, pure_fn,
-             purity, re_anon, re_named, region, rem, required, ret_style,
-             return_val, self_ty, shl, shr, stmt, stmt_decl, stmt_expr,
-             stmt_semi, subtract, sty_box, sty_by_ref, sty_region, sty_uniq,
-             sty_value, token_tree, trait_method, trait_ref, tt_delim, tt_seq,
-             tt_tok, tt_nonterminal, ty, ty_, ty_bot, ty_box, ty_field, ty_fn,
+             pat_wild, path, private, proto, proto_bare, proto_block,
+             proto_box, proto_uniq, provided, public, pure_fn, purity,
+             re_anon, re_named, region, rem, required, ret_style, return_val,
+             self_ty, shl, shr, stmt, stmt_decl, stmt_expr, stmt_semi,
+             subtract, sty_box, sty_by_ref, sty_region, sty_uniq, sty_value,
+             token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok,
+             tt_nonterminal, ty, ty_, ty_bot, ty_box, ty_field, ty_fn,
              ty_infer, ty_mac, ty_method, ty_nil, ty_param, ty_path, ty_ptr,
              ty_rec, ty_rptr, ty_tup, ty_u32, ty_uniq, ty_vec,
              ty_fixed_length, unchecked_blk, uniq, unsafe_blk, unsafe_fn,
@@ -801,9 +801,6 @@ class parser {
             let proto = self.parse_fn_ty_proto();
             alt proto {
               proto_bare { self.fatal(~"fn expr are deprecated, use fn@"); }
-              proto_any {
-                self.fatal(~"fn* cannot be used in an expression");
-              }
               _ { /* fallthrough */ }
             }
             return pexpr(self.parse_fn_expr(proto));
@@ -2781,7 +2778,7 @@ class parser {
             proto_block
           }
           _ {
-            proto_any
+            proto_block
           }
         }
     }
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 9eccf688233..eaacf6cd424 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1823,7 +1823,6 @@ fn print_purity(s: ps, p: ast::purity) {
 fn proto_to_str(p: ast::proto) -> ~str {
     return alt p {
       ast::proto_bare { ~"extern fn" }
-      ast::proto_any { ~"fn" }
       ast::proto_block { ~"fn&" }
       ast::proto_uniq { ~"fn~" }
       ast::proto_box { ~"fn@" }
diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs
index df7bea1bd0e..ad3f09f8086 100644
--- a/src/rustc/metadata/tydecode.rs
+++ b/src/rustc/metadata/tydecode.rs
@@ -89,7 +89,6 @@ fn parse_proto(c: char) -> ast::proto {
     alt c {
       '~' { ast::proto_uniq }
       '@' { ast::proto_box }
-      '*' { ast::proto_any }
       '&' { ast::proto_block }
       'n' { ast::proto_bare }
       _ { fail ~"illegal fn type kind " + str::from_char(c); }
diff --git a/src/rustc/metadata/tyencode.rs b/src/rustc/metadata/tyencode.rs
index 02a6b0f826a..01fc90cc19d 100644
--- a/src/rustc/metadata/tyencode.rs
+++ b/src/rustc/metadata/tyencode.rs
@@ -311,7 +311,6 @@ fn enc_proto(w: io::writer, proto: proto) {
       proto_uniq { w.write_str(&"f~"); }
       proto_box { w.write_str(&"f@"); }
       proto_block { w.write_str(~"f&"); }
-      proto_any { w.write_str(&"f*"); }
       proto_bare { w.write_str(&"fn"); }
     }
 }
diff --git a/src/rustc/middle/borrowck/categorization.rs b/src/rustc/middle/borrowck/categorization.rs
index ea362e1dfac..f2516a30bca 100644
--- a/src/rustc/middle/borrowck/categorization.rs
+++ b/src/rustc/middle/borrowck/categorization.rs
@@ -244,7 +244,7 @@ impl public_methods for borrowck_ctxt {
             let ty = ty::node_id_to_type(self.tcx, fn_node_id);
             let proto = ty::ty_fn_proto(ty);
             alt proto {
-              ast::proto_any | ast::proto_block {
+              ast::proto_block {
                 let upcmt = self.cat_def(id, span, expr_ty, *inner);
                 @{id:id, span:span,
                   cat:cat_stack_upvar(upcmt), lp:upcmt.lp,
diff --git a/src/rustc/middle/borrowck/check_loans.rs b/src/rustc/middle/borrowck/check_loans.rs
index 4fa149b931b..022bdcebfb1 100644
--- a/src/rustc/middle/borrowck/check_loans.rs
+++ b/src/rustc/middle/borrowck/check_loans.rs
@@ -220,7 +220,7 @@ impl methods for check_loan_ctxt {
         let fn_ty = ty::node_id_to_type(self.tcx(), id);
         let proto = ty::ty_fn_proto(fn_ty);
         alt proto {
-          ast::proto_block | ast::proto_any {true}
+          ast::proto_block {true}
           ast::proto_bare | ast::proto_uniq | ast::proto_box {false}
         }
     }
diff --git a/src/rustc/middle/capture.rs b/src/rustc/middle/capture.rs
index 2a08018ebba..dcb7a70ab50 100644
--- a/src/rustc/middle/capture.rs
+++ b/src/rustc/middle/capture.rs
@@ -102,7 +102,7 @@ fn compute_capture_vars(tcx: ty::ctxt,
     // named and add that
 
     let implicit_mode = alt fn_proto {
-      ast::proto_any | ast::proto_block { cap_ref }
+      ast::proto_block { cap_ref }
       ast::proto_bare | ast::proto_box | ast::proto_uniq { cap_copy }
     };
 
diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs
index dd83b01fbe0..263af391a93 100644
--- a/src/rustc/middle/kind.rs
+++ b/src/rustc/middle/kind.rs
@@ -148,7 +148,7 @@ fn with_appropriate_checker(cx: ctx, id: node_id, b: fn(check_fn)) {
       proto_uniq { b(check_for_uniq) }
       proto_box { b(check_for_box) }
       proto_bare { b(check_for_bare) }
-      proto_any | proto_block { b(check_for_block) }
+      proto_block { b(check_for_block) }
     }
 }
 
diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs
index 804ee5ba83c..7204ba67380 100644
--- a/src/rustc/middle/trans/closure.rs
+++ b/src/rustc/middle/trans/closure.rs
@@ -388,7 +388,7 @@ fn trans_expr_fn(bcx: block,
     };
 
     let {bcx: bcx, val: closure} = alt proto {
-      ast::proto_any | ast::proto_block { trans_closure_env(ty::ck_block) }
+      ast::proto_block { trans_closure_env(ty::ck_block) }
       ast::proto_box { trans_closure_env(ty::ck_box) }
       ast::proto_uniq { trans_closure_env(ty::ck_uniq) }
       ast::proto_bare {
@@ -423,8 +423,7 @@ fn make_fn_glue(
 
     return alt ty::get(t).struct {
       ty::ty_fn({proto: ast::proto_bare, _}) |
-      ty::ty_fn({proto: ast::proto_block, _}) |
-      ty::ty_fn({proto: ast::proto_any, _}) { bcx }
+      ty::ty_fn({proto: ast::proto_block, _}) { bcx }
       ty::ty_fn({proto: ast::proto_uniq, _}) { fn_env(ty::ck_uniq) }
       ty::ty_fn({proto: ast::proto_box, _}) { fn_env(ty::ck_box) }
       _ { fail ~"make_fn_glue invoked on non-function type" }
diff --git a/src/rustc/middle/trans/foreign.rs b/src/rustc/middle/trans/foreign.rs
index 129e737bb29..ceca9aa2ef4 100644
--- a/src/rustc/middle/trans/foreign.rs
+++ b/src/rustc/middle/trans/foreign.rs
@@ -968,7 +968,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
         let frameaddress_val = Call(bcx, frameaddress, ~[C_i32(0i32)]);
         let fty = ty::mk_fn(bcx.tcx(), {
             purity: ast::impure_fn,
-            proto: ast::proto_any,
+            proto: ast::proto_block,
             inputs: ~[{
                 mode: ast::expl(ast::by_val),
                 ty: ty::mk_imm_ptr(
diff --git a/src/rustc/middle/trans/reflect.rs b/src/rustc/middle/trans/reflect.rs
index 5b833a91538..f83d4a2ccc6 100644
--- a/src/rustc/middle/trans/reflect.rs
+++ b/src/rustc/middle/trans/reflect.rs
@@ -186,7 +186,6 @@ impl methods for reflector {
             };
             let protoval = alt fty.proto {
               ast::proto_bare { 0u }
-              ast::proto_any { 1u }
               ast::proto_uniq { 2u }
               ast::proto_box { 3u }
               ast::proto_block { 4u }
diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs
index 11310afd0ff..1e25501da6c 100644
--- a/src/rustc/middle/trans/shape.rs
+++ b/src/rustc/middle/trans/shape.rs
@@ -354,8 +354,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
       }
       ty::ty_fn({proto: ast::proto_box, _}) { ~[shape_box_fn] }
       ty::ty_fn({proto: ast::proto_uniq, _}) { ~[shape_uniq_fn] }
-      ty::ty_fn({proto: ast::proto_block, _}) |
-      ty::ty_fn({proto: ast::proto_any, _}) { ~[shape_stack_fn] }
+      ty::ty_fn({proto: ast::proto_block, _}) { ~[shape_stack_fn] }
       ty::ty_fn({proto: ast::proto_bare, _}) { ~[shape_bare_fn] }
       ty::ty_opaque_closure_ptr(_) { ~[shape_opaque_closure_ptr] }
       ty::ty_var(_) | ty::ty_var_integral(_) | ty::ty_self {
diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs
index 0f9393831ac..fd21d227632 100644
--- a/src/rustc/middle/trans/type_use.rs
+++ b/src/rustc/middle/trans/type_use.rs
@@ -192,7 +192,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
       }
       expr_fn(*) | expr_fn_block(*) {
         alt ty::ty_fn_proto(ty::expr_ty(cx.ccx.tcx, e)) {
-          proto_bare | proto_any | proto_uniq {}
+          proto_bare | proto_uniq {}
           proto_box | proto_block {
             for vec::each(*freevars::get_freevars(cx.ccx.tcx, e.id)) |fv| {
                 let node_id = ast_util::def_id_of_def(fv.def).node;
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs
index 29dbccc43f5..af05c3cfcbf 100644
--- a/src/rustc/middle/ty.rs
+++ b/src/rustc/middle/ty.rs
@@ -1291,7 +1291,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
       }
       ty_fn(fty) {
         alt fty.proto {
-          proto_bare | proto_any | proto_block { false }
+          proto_bare | proto_block { false }
           _ { true }
         }
       }
@@ -1533,7 +1533,6 @@ pure fn kind_is_owned(k: kind) -> bool {
 
 fn proto_kind(p: proto) -> kind {
     alt p {
-      ast::proto_any { kind_noncopyable() }
       ast::proto_block { kind_noncopyable() }
       ast::proto_box { kind_safe_for_default_mode() | kind_owned() }
       ast::proto_uniq { kind_send_copy() | kind_owned() }
diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs
index 1297a39c520..b362b00c55b 100644
--- a/src/rustc/middle/typeck/check.rs
+++ b/src/rustc/middle/typeck/check.rs
@@ -2396,7 +2396,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
       ~"frame_address" {
         let fty = ty::mk_fn(ccx.tcx, {
             purity: ast::impure_fn,
-            proto: ast::proto_any,
+            proto: ast::proto_block,
             inputs: ~[{
                 mode: ast::expl(ast::by_val),
                 ty: ty::mk_imm_ptr(
diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs
index e80a2c8070a..2a357decd2e 100644
--- a/src/rustc/middle/typeck/collect.rs
+++ b/src/rustc/middle/typeck/collect.rs
@@ -395,7 +395,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
                  tps: ty::ty_params_to_tys(tcx, tps)});
             let t_ctor = ty::mk_fn(
                 tcx, {purity: ast::impure_fn,
-                      proto: ast::proto_any,
+                      proto: ast::proto_block,
                       inputs: t_args,
                       output: t_res,
                       ret_style: ast::return_val});
@@ -410,7 +410,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
             // Write the dtor type
             let t_dtor = ty::mk_fn(
                 tcx,
-                ty_of_fn_decl(ccx, type_rscope(rp), ast::proto_any,
+                ty_of_fn_decl(ccx, type_rscope(rp), ast::proto_block,
                               ast_util::dtor_dec(), none));
             write_ty_to_tcx(tcx, dtor.node.id, t_dtor);
             tcx.tcache.insert(local_def(dtor.node.id),
diff --git a/src/rustc/middle/typeck/infer.rs b/src/rustc/middle/typeck/infer.rs
index b1ad11327a7..4dec95eee30 100644
--- a/src/rustc/middle/typeck/infer.rs
+++ b/src/rustc/middle/typeck/infer.rs
@@ -2120,7 +2120,7 @@ impl of combine for lub {
         } else if p1 == p2 {
             ok(p1)
         } else {
-            ok(ast::proto_any)
+            ok(ast::proto_block)
         }
     }
 
@@ -2314,9 +2314,9 @@ impl of combine for glb {
     }
 
     fn protos(p1: ast::proto, p2: ast::proto) -> cres<ast::proto> {
-        if p1 == ast::proto_any {
+        if p1 == ast::proto_block {
             ok(p2)
-        } else if p2 == ast::proto_any {
+        } else if p2 == ast::proto_block {
             ok(p1)
         } else if p1 == p2 {
             ok(p1)
diff --git a/src/test/compile-fail/block-coerce-no.rs b/src/test/compile-fail/block-coerce-no.rs
index f407d362603..dfa2fdab6e3 100644
--- a/src/test/compile-fail/block-coerce-no.rs
+++ b/src/test/compile-fail/block-coerce-no.rs
@@ -6,7 +6,7 @@ fn coerce(b: fn()) -> extern fn() {
            g: fn()) -> extern fn() { return f(g); }
     fn fn_id(f: extern fn()) -> extern fn() { return f }
     return lol(fn_id, b);
-    //~^ ERROR mismatched types: expected `extern fn(fn()) -> extern fn()`
+    //~^ ERROR mismatched types: expected `extern fn(fn&()) -> extern fn()`
 }
 
 fn main() {
diff --git a/src/test/compile-fail/extern-wrong-value-type.rs b/src/test/compile-fail/extern-wrong-value-type.rs
index 3f17f61dc05..dccd1279871 100644
--- a/src/test/compile-fail/extern-wrong-value-type.rs
+++ b/src/test/compile-fail/extern-wrong-value-type.rs
@@ -1,8 +1,8 @@
-// error-pattern:expected `fn()` but found `*u8`
+// error-pattern:expected `fn&()` but found `*u8`
 extern fn f() {
 }
 
 fn main() {
     // extern functions are *u8 types
     let _x: fn() = f;
-}
\ No newline at end of file
+}
diff --git a/src/test/compile-fail/missing-do.rs b/src/test/compile-fail/missing-do.rs
index 9ea339641b3..83c6bc32cc9 100644
--- a/src/test/compile-fail/missing-do.rs
+++ b/src/test/compile-fail/missing-do.rs
@@ -4,6 +4,6 @@ fn foo(f: fn()) { f() }
 
 fn main() {
     ~"" || 42; //~ ERROR binary operation || cannot be applied to type `~str`
-    foo || {}; //~ ERROR binary operation || cannot be applied to type `extern fn(fn())`
+    foo || {}; //~ ERROR binary operation || cannot be applied to type `extern fn(fn&())`
     //~^ NOTE did you forget the 'do' keyword for the call?
 }