about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-09-14 10:38:23 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-09-14 10:38:23 +0200
commit6eb9738a661f577eeb972032b5570013e6bcafdd (patch)
tree526faf2c5e590605d2d796371c75a9e98c35f1ef /src
parentf6fe07d1f3f8e98120169dea59ebc4d2eee4255c (diff)
downloadrust-6eb9738a661f577eeb972032b5570013e6bcafdd.tar.gz
rust-6eb9738a661f577eeb972032b5570013e6bcafdd.zip
Rename ast::controlflow to ast::ret_style
It will include information about returning by alias.
Diffstat (limited to 'src')
-rw-r--r--src/comp/front/test.rs6
-rw-r--r--src/comp/metadata/tydecode.rs4
-rw-r--r--src/comp/metadata/tyencode.rs5
-rw-r--r--src/comp/middle/tstate/auxiliary.rs6
-rw-r--r--src/comp/middle/tstate/ck.rs4
-rw-r--r--src/comp/middle/tstate/pre_post_conditions.rs2
-rw-r--r--src/comp/middle/tstate/states.rs12
-rw-r--r--src/comp/middle/ty.rs16
-rw-r--r--src/comp/middle/typeck.rs18
-rw-r--r--src/comp/syntax/ast.rs15
-rw-r--r--src/comp/syntax/parse/parser.rs19
-rw-r--r--src/comp/syntax/print/pprust.rs4
-rw-r--r--src/comp/util/ppaux.rs8
13 files changed, 58 insertions, 61 deletions
diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs
index 2f68c1fc671..fcc4f883139 100644
--- a/src/comp/front/test.rs
+++ b/src/comp/front/test.rs
@@ -178,7 +178,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item {
          output: ret_ty,
          purity: ast::impure_fn,
          il: ast::il_normal,
-         cf: ast::return,
+         cf: ast::return_val,
          constraints: []};
     let proto = ast::proto_fn;
 
@@ -205,7 +205,7 @@ fn empty_fn_ty() -> ast::ty {
     let proto = ast::proto_fn;
     let input_ty = [];
     let ret_ty = @nospan(ast::ty_nil);
-    let cf = ast::return;
+    let cf = ast::return_val;
     let constrs = [];
     ret nospan(ast::ty_fn(proto, input_ty, ret_ty, cf, constrs));
 }
@@ -298,7 +298,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
          output: @ret_ty,
          purity: ast::impure_fn,
          il: ast::il_normal,
-         cf: ast::return,
+         cf: ast::return_val,
          constraints: []};
     let proto = ast::proto_fn;
 
diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs
index 883fd0328f2..cc342fe4647 100644
--- a/src/comp/metadata/tydecode.rs
+++ b/src/comp/metadata/tydecode.rs
@@ -371,7 +371,7 @@ fn parse_hex(st: @pstate) -> uint {
 }
 
 fn parse_ty_fn(st: @pstate, sd: str_def) ->
-   {args: [ty::arg], ty: ty::t, cf: ast::controlflow, cs: [@ty::constr]} {
+   {args: [ty::arg], ty: ty::t, cf: ast::ret_style, cs: [@ty::constr]} {
     assert (next(st) as char == '[');
     let inputs: [ty::arg] = [];
     while peek(st) as char != ']' {
@@ -391,7 +391,7 @@ fn parse_ty_fn(st: @pstate, sd: str_def) ->
       a_bang. {
         ret {args: inputs, ty: ty::mk_bot(st.tcx), cf: ast::noreturn, cs: cs};
       }
-      a_ty(t) { ret {args: inputs, ty: t, cf: ast::return, cs: cs}; }
+      a_ty(t) { ret {args: inputs, ty: t, cf: ast::return_val, cs: cs}; }
     }
 }
 
diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs
index 32bcefa0442..07df8fed24a 100644
--- a/src/comp/metadata/tyencode.rs
+++ b/src/comp/metadata/tyencode.rs
@@ -148,7 +148,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
           native_abi_llvm. { w.write_char('l'); }
           native_abi_x86stdcall. { w.write_char('s'); }
         }
-        enc_ty_fn(w, cx, args, out, return, []);
+        enc_ty_fn(w, cx, args, out, return_val, []);
       }
       ty::ty_obj(methods) {
         w.write_str("O[");
@@ -199,7 +199,7 @@ fn enc_proto(w: io::writer, proto: proto) {
 }
 
 fn enc_ty_fn(w: io::writer, cx: @ctxt, args: [ty::arg], out: ty::t,
-             cf: controlflow, constrs: [@ty::constr]) {
+             cf: ret_style, constrs: [@ty::constr]) {
     w.write_char('[');
     for arg: ty::arg in args {
         alt arg.mode {
@@ -219,7 +219,6 @@ fn enc_ty_fn(w: io::writer, cx: @ctxt, args: [ty::arg], out: ty::t,
         enc_constr(w, cx, c);
     }
     alt cf { noreturn. { w.write_char('!'); } _ { enc_ty(w, cx, out); } }
-
 }
 
 // FIXME less copy-and-paste
diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs
index 62638dd0d43..45c25980baf 100644
--- a/src/comp/middle/tstate/auxiliary.rs
+++ b/src/comp/middle/tstate/auxiliary.rs
@@ -254,7 +254,7 @@ type fn_info =
     // Doesn't seem to work without the @ -- bug
     {constrs: constr_map,
      num_constraints: uint,
-     cf: controlflow,
+     cf: ret_style,
      i_return: tsconstr,
      i_diverge: tsconstr,
      used_vars: @mutable [node_id]};
@@ -489,10 +489,10 @@ fn new_crate_ctxt(cx: ty::ctxt) -> crate_ctxt {
 /* Use e's type to determine whether it returns.
  If it has a function type with a ! annotation,
 the answer is noreturn. */
-fn controlflow_expr(ccx: crate_ctxt, e: @expr) -> controlflow {
+fn controlflow_expr(ccx: crate_ctxt, e: @expr) -> ret_style {
     alt ty::struct(ccx.tcx, ty::node_id_to_type(ccx.tcx, e.id)) {
       ty::ty_fn(_, _, _, cf, _) { ret cf; }
-      _ { ret return; }
+      _ { ret return_val; }
     }
 }
 
diff --git a/src/comp/middle/tstate/ck.rs b/src/comp/middle/tstate/ck.rs
index 68d91b5083e..45dc8d87d2b 100644
--- a/src/comp/middle/tstate/ck.rs
+++ b/src/comp/middle/tstate/ck.rs
@@ -1,7 +1,7 @@
 
 import syntax::ast;
 import ast::{method, item, item_fn, _fn, obj_field, _obj, stmt, ident,
-             fn_ident, node_id, def_id, ty_param, crate, return, noreturn,
+             fn_ident, node_id, def_id, ty_param, crate, return_val, noreturn,
              expr};
 import syntax::ast_util::local_def;
 import syntax::visit;
@@ -119,7 +119,7 @@ fn check_states_against_conditions(fcx: fn_ctxt, f: _fn, tps: [ast::ty_param],
     if f.proto != ast::proto_iter &&
            !promises(fcx, post, fcx.enclosing.i_return) &&
            !type_is_nil(fcx.ccx.tcx, ret_ty_of_fn(fcx.ccx.tcx, id)) &&
-           f.decl.cf == return {
+           f.decl.cf == return_val {
         fcx.ccx.tcx.sess.span_err(f.body.span,
                                   "In function " + fcx.name +
                                       ", not all control paths \
diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs
index d5a7e5c9c06..a37092e97af 100644
--- a/src/comp/middle/tstate/pre_post_conditions.rs
+++ b/src/comp/middle/tstate/pre_post_conditions.rs
@@ -52,7 +52,7 @@ fn find_pre_post_item(ccx: crate_ctxt, i: item) {
              enclosing:
                  {constrs: @new_def_hash::<constraint>(),
                   num_constraints: 0u,
-                  cf: return,
+                  cf: return_val,
                   i_return: ninit(0, ""),
                   i_diverge: ninit(0, ""),
                   used_vars: v},
diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs
index f2da03c8bc3..620592fd378 100644
--- a/src/comp/middle/tstate/states.rs
+++ b/src/comp/middle/tstate/states.rs
@@ -169,7 +169,7 @@ fn find_pre_post_state_two(fcx: fn_ctxt, pres: prestate, lhs: @expr,
 
 fn find_pre_post_state_call(fcx: fn_ctxt, pres: prestate, a: @expr,
                             id: node_id, ops: [init_op], bs: [@expr],
-                            cf: controlflow) -> bool {
+                            cf: ret_style) -> bool {
     let changed = find_pre_post_state_expr(fcx, pres, a);
     // FIXME: This could be a typestate constraint
     if vec::len(bs) != vec::len(ops) {
@@ -183,7 +183,7 @@ fn find_pre_post_state_call(fcx: fn_ctxt, pres: prestate, a: @expr,
 }
 
 fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id,
-                             ops: [init_op], es: [@expr], cf: controlflow) ->
+                             ops: [init_op], es: [@expr], cf: ret_style) ->
    bool {
     let rs = seq_states(fcx, pres, anon_bindings(ops, es));
     let changed = rs.changed | set_prestate_ann(fcx.ccx, id, pres);
@@ -333,7 +333,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
         ret find_pre_post_state_exprs(fcx, pres, e.id,
                                       vec::init_elt(init_assign,
                                                     vec::len(elts)), elts,
-                                      return);
+                                      return_val);
       }
       expr_call(operator, operands) {
         ret find_pre_post_state_call(fcx, pres, operator, e.id,
@@ -354,7 +354,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
             i += 1;
         }
         ret find_pre_post_state_call(fcx, pres, operator, e.id, ops, args,
-                                     return);
+                                     return_val);
       }
       expr_path(_) { ret pure_exp(fcx.ccx, e.id, pres); }
       expr_log(_, ex) {
@@ -381,7 +381,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
             find_pre_post_state_exprs(fcx, pres, e.id,
                                       vec::init_elt(init_assign,
                                                     vec::len(fields)),
-                                      field_exprs(fields), return);
+                                      field_exprs(fields), return_val);
         alt maybe_base {
           none. {/* do nothing */ }
           some(base) {
@@ -397,7 +397,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
         ret find_pre_post_state_exprs(fcx, pres, e.id,
                                       vec::init_elt(init_assign,
                                                     vec::len(elts)), elts,
-                                      return);
+                                      return_val);
       }
       expr_copy(a) { ret find_pre_post_state_sub(fcx, pres, a, e.id, none); }
       expr_move(lhs, rhs) {
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 082644dbd72..f2d91c5729b 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -185,7 +185,7 @@ type method =
      ident: ast::ident,
      inputs: [arg],
      output: t,
-     cf: controlflow,
+     cf: ret_style,
      constrs: [@constr]};
 
 type constr_table = hashmap<ast::node_id, [constr]>;
@@ -255,7 +255,7 @@ tag sty {
     ty_vec(mt);
     ty_ptr(mt);
     ty_rec([field]);
-    ty_fn(ast::proto, [arg], t, controlflow, [@constr]);
+    ty_fn(ast::proto, [arg], t, ret_style, [@constr]);
     ty_native_fn(ast::native_abi, [arg], t);
     ty_obj([method]);
     ty_res(def_id, t, [t]);
@@ -556,7 +556,7 @@ fn mk_constr(cx: ctxt, t: t, cs: [@type_constr]) -> t {
 
 fn mk_tup(cx: ctxt, ts: [t]) -> t { ret gen_ty(cx, ty_tup(ts)); }
 
-fn mk_fn(cx: ctxt, proto: ast::proto, args: [arg], ty: t, cf: controlflow,
+fn mk_fn(cx: ctxt, proto: ast::proto, args: [arg], ty: t, cf: ret_style,
          constrs: [@constr]) -> t {
     ret gen_ty(cx, ty_fn(proto, args, ty, cf, constrs));
 }
@@ -583,7 +583,7 @@ fn mk_native(cx: ctxt, did: def_id) -> t { ret gen_ty(cx, ty_native(did)); }
 
 fn mk_iter_body_fn(cx: ctxt, output: t) -> t {
     ret mk_fn(cx, ast::proto_block, [{mode: ast::by_ref, ty: output}],
-              ty::mk_nil(cx), ast::return, []);
+              ty::mk_nil(cx), ast::return_val, []);
 }
 
 // Returns the one-level-deep type structure of the given type.
@@ -1948,16 +1948,12 @@ mod unify {
     fn unify_fn(cx: @ctxt, e_proto: ast::proto, a_proto: ast::proto,
                 expected: t, actual: t, expected_inputs: [arg],
                 expected_output: t, actual_inputs: [arg], actual_output: t,
-                expected_cf: controlflow, actual_cf: controlflow,
+                expected_cf: ret_style, actual_cf: ret_style,
                 _expected_constrs: [@constr], actual_constrs: [@constr]) ->
        result {
         if e_proto != a_proto { ret ures_err(terr_mismatch); }
         alt expected_cf {
-          ast::return. { }
-
-
-
-
+          ast::return_val. { }
           // ok
           ast::noreturn. {
             alt actual_cf {
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 848bed1bdd5..5608f57ddcc 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -593,8 +593,8 @@ mod collect {
         }
 
         let t_fn =
-            ty::mk_fn(cx.tcx, ast::proto_fn, t_inputs, t_obj.ty, ast::return,
-                      []);
+            ty::mk_fn(cx.tcx, ast::proto_fn, t_inputs, t_obj.ty,
+                      ast::return_val, []);
         let tpt = {kinds: ty_param_kinds(ty_params), ty: t_fn};
         cx.tcx.tcache.insert(local_def(ctor_id), tpt);
         ret tpt;
@@ -704,8 +704,8 @@ mod collect {
                 let tag_t = ty::mk_tag(cx.tcx, tag_id, ty_param_tys);
                 // FIXME: this will be different for constrained types
                 result_ty =
-                    ty::mk_fn(cx.tcx, ast::proto_fn, args, tag_t, ast::return,
-                              []);
+                    ty::mk_fn(cx.tcx, ast::proto_fn, args, tag_t,
+                              ast::return_val, []);
             }
             let tpt = {kinds: ty_param_kinds(ty_params), ty: result_ty};
             cx.tcx.tcache.insert(local_def(variant.node.id), tpt);
@@ -774,11 +774,11 @@ mod collect {
                 ty::mk_res(cx.tcx, local_def(it.id), t_arg.ty,
                            mk_ty_params(cx, tps));
             let t_ctor =
-                ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], t_res, ast::return,
-                          []);
+                ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], t_res,
+                          ast::return_val, []);
             let t_dtor =
                 ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], ty::mk_nil(cx.tcx),
-                          ast::return, []);
+                          ast::return_val, []);
             write::ty_only(cx.tcx, it.id, t_res);
             write::ty_only(cx.tcx, ctor_id, t_ctor);
             cx.tcx.tcache.insert(local_def(ctor_id),
@@ -2010,7 +2010,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
             proto = ast::proto_fn;
             arg_tys = arg_tys_;
             rt = rt_;
-            cf = ast::return;
+            cf = ast::return_val;
             constrs = [];
           }
           _ { fail "LHS of bind expr didn't have a function type?!"; }
@@ -2685,7 +2685,7 @@ fn arg_is_argv_ty(tcx: ty::ctxt, a: ty::arg) -> bool {
 fn check_main_fn_ty(tcx: ty::ctxt, main_id: ast::node_id) {
     let main_t = ty::node_id_to_monotype(tcx, main_id);
     alt ty::struct(tcx, main_t) {
-      ty::ty_fn(ast::proto_fn., args, rs, ast::return., constrs) {
+      ty::ty_fn(ast::proto_fn., args, rs, ast::return_val., constrs) {
         let ok = vec::len(constrs) == 0u;
         ok &= ty::type_is_nil(tcx, rs);
         let num_args = vec::len(args);
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs
index 6032ea11dbc..0db696654be 100644
--- a/src/comp/syntax/ast.rs
+++ b/src/comp/syntax/ast.rs
@@ -261,7 +261,7 @@ type ty_method_ =
      ident: ident,
      inputs: [ty_arg],
      output: @ty,
-     cf: controlflow,
+     cf: ret_style,
      constrs: [@constr]};
 
 type ty_field = spanned<ty_field_>;
@@ -311,7 +311,7 @@ tag ty_ {
     ty_port(@ty);
     ty_chan(@ty);
     ty_rec([ty_field]);
-    ty_fn(proto, [ty_arg], @ty, controlflow, [@constr]);
+    ty_fn(proto, [ty_arg], @ty, ret_style, [@constr]);
     ty_obj([ty_method]);
     ty_tup([@ty]);
     ty_path(path, node_id);
@@ -369,7 +369,7 @@ type fn_decl =
      output: @ty,
      purity: purity,
      il: inlineness,
-     cf: controlflow,
+     cf: ret_style,
      constraints: [@constr]};
 
 tag purity {
@@ -377,14 +377,11 @@ tag purity {
     impure_fn; // declared with "fn"
 }
 
-tag controlflow {
+tag ret_style {
     noreturn; // functions with return type _|_ that always
               // raise an error or exit (i.e. never return to the caller)
-
-
-
-
-    return; // everything else
+    return_val; // everything else
+    return_alias;
 }
 
 type _fn = {decl: fn_decl, proto: proto, body: blk};
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 5006277ec6b..e6679f60b17 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -289,10 +289,10 @@ fn parse_ty_fn(proto: ast::proto, p: parser) -> ast::ty_ {
     //  auto constrs = parse_constrs(~[], p);
     let constrs: [@ast::constr] = [];
     let output: @ast::ty;
-    let cf = ast::return;
+    let cf = ast::return_val;
     if p.peek() == token::RARROW {
         p.bump();
-        let tmp = parse_ty_or_bang(p);
+        let tmp = parse_ret_ty(p);
         alt tmp {
           a_ty(t) { output = t; }
           a_bang. {
@@ -452,7 +452,12 @@ fn parse_ty_postfix(orig_t: ast::ty_, p: parser, colons_before_params: bool)
     }
 }
 
-fn parse_ty_or_bang(p: parser) -> ty_or_bang {
+fn parse_ret_ty(p: parser) -> ty_or_bang {
+/*    if eat(p, token::RARROW) {
+
+    } else {
+
+    }*/
     alt p.peek() {
       token::NOT. { p.bump(); ret a_bang; }
       _ { ret a_ty(parse_ty(p, false)); }
@@ -1766,7 +1771,7 @@ fn parse_fn_decl(p: parser, purity: ast::purity, il: ast::inlineness) ->
     }
     if p.peek() == token::RARROW {
         p.bump();
-        rslt = parse_ty_or_bang(p);
+        rslt = parse_ret_ty(p);
     } else {
         rslt = a_ty(@spanned(inputs.span.lo, inputs.span.hi, ast::ty_nil));
     }
@@ -1776,7 +1781,7 @@ fn parse_fn_decl(p: parser, purity: ast::purity, il: ast::inlineness) ->
              output: t,
              purity: purity,
              il: il,
-             cf: ast::return,
+             cf: ast::return_val,
              constraints: constrs};
       }
       a_bang. {
@@ -1803,7 +1808,7 @@ fn parse_fn_block_decl(p: parser) -> ast::fn_decl {
          output: @spanned(p.get_lo_pos(), p.get_hi_pos(), ast::ty_infer),
          purity: ast::impure_fn,
          il: ast::il_normal,
-         cf: ast::return,
+         cf: ast::return_val,
          constraints: []};
 }
 
@@ -1899,7 +1904,7 @@ fn parse_item_res(p: parser, attrs: [ast::attribute]) -> @ast::item {
          output: @spanned(lo, lo, ast::ty_nil),
          purity: ast::impure_fn,
          il: ast::il_normal,
-         cf: ast::return,
+         cf: ast::return_val,
          constraints: []};
     let f = {decl: decl, proto: ast::proto_fn, body: dtor};
     ret mk_item(p, lo, dtor.span.hi, ident,
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index f401d4e3736..4230beab7db 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -1401,7 +1401,7 @@ fn print_mt(s: ps, mt: ast::mt) {
 }
 
 fn print_ty_fn(s: ps, proto: ast::proto, id: option::t<ast::ident>,
-               inputs: [ast::ty_arg], output: @ast::ty, cf: ast::controlflow,
+               inputs: [ast::ty_arg], output: @ast::ty, cf: ast::ret_style,
                constrs: [@ast::constr]) {
     ibox(s, indent_unit);
     word(s.s, proto_to_str(proto));
@@ -1420,7 +1420,7 @@ fn print_ty_fn(s: ps, proto: ast::proto, id: option::t<ast::ident>,
         ibox(s, indent_unit);
         word_space(s, "->");
         alt cf {
-          ast::return. { print_type(s, output); }
+          ast::return_val. { print_type(s, output); }
           ast::noreturn. { word_nbsp(s, "!"); }
         }
         end(s);
diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs
index cb74f721728..7e299922fe8 100644
--- a/src/comp/util/ppaux.rs
+++ b/src/comp/util/ppaux.rs
@@ -48,7 +48,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
         ret s + ty_to_str(cx, input.ty);
     }
     fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option::t<ast::ident>,
-                 inputs: [arg], output: t, cf: ast::controlflow,
+                 inputs: [arg], output: t, cf: ast::ret_style,
                  constrs: [@constr]) -> str {
         let s = proto_to_str(proto);
         alt ident { some(i) { s += " "; s += i; } _ { } }
@@ -60,7 +60,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
         if struct(cx, output) != ty_nil {
             alt cf {
               ast::noreturn. { s += " -> !"; }
-              ast::return. { s += " -> " + ty_to_str(cx, output); }
+              ast::return_val. { s += " -> " + ty_to_str(cx, output); }
             }
         }
         s += constrs_str(constrs);
@@ -121,8 +121,8 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
             fn_to_str(cx, proto, none, inputs, output, cf, constrs)
           }
           ty_native_fn(_, inputs, output) {
-            fn_to_str(cx, ast::proto_fn, none, inputs, output, ast::return,
-                      [])
+            fn_to_str(cx, ast::proto_fn, none, inputs, output,
+                      ast::return_val, [])
           }
           ty_obj(meths) {
             let strs = [];