Skip to content

Commit 4b30a06

Browse files
committed
Rename ast::proto_fn to ast::proto_shared
1 parent 29ad3bd commit 4b30a06

File tree

13 files changed

+32
-31
lines changed

13 files changed

+32
-31
lines changed

src/comp/front/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item {
192192
il: ast::il_normal,
193193
cf: ast::return_val,
194194
constraints: []};
195-
let proto = ast::proto_fn;
195+
let proto = ast::proto_shared;
196196

197197
// The vector of test_descs for this crate
198198
let test_descs = mk_test_desc_vec(cx);
@@ -214,7 +214,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item {
214214
}
215215

216216
fn empty_fn_ty() -> ast::ty {
217-
let proto = ast::proto_fn;
217+
let proto = ast::proto_shared;
218218
let input_ty = [];
219219
let ret_ty = @nospan(ast::ty_nil);
220220
let cf = ast::return_val;

src/comp/metadata/tydecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
242242
}
243243
'F' {
244244
let func = parse_ty_fn(st, sd);
245-
ret ty::mk_fn(st.tcx, ast::proto_fn, func.args, func.ty, func.cf,
245+
ret ty::mk_fn(st.tcx, ast::proto_shared, func.args, func.ty, func.cf,
246246
func.cs);
247247
}
248248
'f' {

src/comp/metadata/tyencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
195195
fn enc_proto(w: io::writer, proto: proto) {
196196
alt proto {
197197
proto_iter. { w.write_char('W'); }
198-
proto_fn. { w.write_char('F'); }
198+
proto_shared. { w.write_char('F'); }
199199
proto_block. { w.write_char('B'); }
200200
proto_bare. { w.write_char('f'); }
201201
}

src/comp/middle/resolve.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,8 @@ fn lookup_in_scope_strict(e: env, sc: scopes, sp: span, name: ident,
594594

595595
fn scope_is_fn(sc: scope) -> bool {
596596
ret alt sc {
597-
scope_fn(_, ast::proto_iter., _) | scope_fn(_, ast::proto_fn., _) |
597+
scope_fn(_, ast::proto_iter., _) |
598+
scope_fn(_, ast::proto_shared., _) |
598599
scope_fn(_, ast::proto_bare., _) |
599600
scope_native_item(_) {
600601
true

src/comp/middle/trans.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5349,7 +5349,7 @@ fn trans_res_ctor(cx: @local_ctxt, sp: span, dtor: ast::_fn,
53495349
}
53505350
let fcx = new_fn_ctxt(cx, sp, llctor_decl);
53515351
let ret_t = ty::ret_ty_of_fn(cx.ccx.tcx, ctor_id);
5352-
create_llargs_for_fn_args(fcx, ast::proto_fn, none::<ty::t>, ret_t,
5352+
create_llargs_for_fn_args(fcx, ast::proto_shared, none::<ty::t>, ret_t,
53535353
dtor.decl.inputs, ty_params);
53545354
let bcx = new_top_block_ctxt(fcx);
53555355
let lltop = bcx.llbb;
@@ -5409,7 +5409,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
54095409
}
54105410
}
54115411
let fcx = new_fn_ctxt(cx, variant.span, llfndecl);
5412-
create_llargs_for_fn_args(fcx, ast::proto_fn, none::<ty::t>,
5412+
create_llargs_for_fn_args(fcx, ast::proto_shared, none::<ty::t>,
54135413
ty::ret_ty_of_fn(cx.ccx.tcx, variant.node.id),
54145414
fn_args, ty_params);
54155415
let ty_param_substs: [ty::t] = [];
@@ -5616,7 +5616,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
56165616
let nt = ty::mk_nil(ccx.tcx);
56175617
check non_ty_var(ccx, nt);
56185618

5619-
let llfty = type_of_fn(ccx, sp, ast::proto_fn, false, false,
5619+
let llfty = type_of_fn(ccx, sp, ast::proto_shared, false, false,
56205620
[vecarg_ty], nt, 0u);
56215621
let llfdecl = decl_fn(ccx.llmod, "_rust_main",
56225622
lib::llvm::LLVMCCallConv, llfty);
@@ -5729,7 +5729,7 @@ fn native_fn_wrapper_type(cx: @crate_ctxt, sp: span, ty_param_count: uint,
57295729
alt ty::struct(cx.tcx, x) {
57305730
ty::ty_native_fn(abi, args, out) {
57315731
check non_ty_var(cx, out);
5732-
ret type_of_fn(cx, sp, ast::proto_fn, false, false, args, out,
5732+
ret type_of_fn(cx, sp, ast::proto_shared, false, false, args, out,
57335733
ty_param_count);
57345734
}
57355735
}

src/comp/middle/trans_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
340340
let nil_res = ty::mk_nil(ccx.tcx);
341341
// FIXME: Silly check -- mk_nil should have a postcondition
342342
check non_ty_var(ccx, nil_res);
343-
let f_t = type_of_fn(ccx, sp, ast::proto_fn, false, false,
343+
let f_t = type_of_fn(ccx, sp, ast::proto_shared, false, false,
344344
[{mode: ast::by_ref, ty: inner_t}],
345345
nil_res, params);
346346
ret trans::get_extern_const(ccx.externs, ccx.llmod,

src/comp/middle/trans_objects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn trans_obj(cx: @local_ctxt, sp: span, ob: ast::_obj, ctor_id: ast::node_id,
5252
let lltop = bcx.llbb;
5353

5454
// Both regular arguments and type parameters are handled here.
55-
create_llargs_for_fn_args(fcx, ast::proto_fn, none::<ty::t>,
55+
create_llargs_for_fn_args(fcx, ast::proto_shared, none::<ty::t>,
5656
ty::ret_ty_of_fn(ccx.tcx, ctor_id), fn_args,
5757
ty_params);
5858
let arg_tys: [ty::arg] = arg_tys_of_fn(ccx, ctor_id);

src/comp/middle/ty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ fn type_kind(cx: ctxt, ty: t) -> ast::kind {
10131013
ast::proto_iter. { ast::kind_shared }
10141014
ast::proto_block. { ast::kind_pinned }
10151015
ast::proto_closure. { ast::kind_shared }
1016-
ast::proto_fn. { ast::kind_shared }
1016+
ast::proto_shared. { ast::kind_shared }
10171017
ast::proto_bare. { ast::kind_unique }
10181018
};
10191019
}
@@ -1616,7 +1616,7 @@ fn ty_fn_args(cx: ctxt, fty: t) -> [arg] {
16161616
fn ty_fn_proto(cx: ctxt, fty: t) -> ast::proto {
16171617
alt struct(cx, fty) {
16181618
ty::ty_fn(p, _, _, _, _) { ret p; }
1619-
ty::ty_native_fn(_, _, _) { ret ast::proto_fn; }
1619+
ty::ty_native_fn(_, _, _) { ret ast::proto_shared; }
16201620
_ { cx.sess.bug("ty_fn_proto() called on non-fn type"); }
16211621
}
16221622
}
@@ -2031,7 +2031,7 @@ mod unify {
20312031
// Every function type is a subtype of block
20322032
false
20332033
}
2034-
ast::proto_closure. | ast::proto_fn. {
2034+
ast::proto_closure. | ast::proto_shared. {
20352035
a_proto == ast::proto_block
20362036
}
20372037
ast::proto_bare. {

src/comp/middle/typeck.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ mod write {
479479
fn proto_to_ty_proto(proto: ast::proto) -> ast::proto {
480480
ret alt proto {
481481
ast::proto_iter. | ast::proto_block. | ast::proto_bare. { proto }
482-
_ { ast::proto_fn }
482+
_ { ast::proto_shared }
483483
};
484484
}
485485

@@ -612,7 +612,7 @@ mod collect {
612612
}
613613

614614
let t_fn =
615-
ty::mk_fn(cx.tcx, ast::proto_fn, t_inputs, t_obj.ty,
615+
ty::mk_fn(cx.tcx, ast::proto_shared, t_inputs, t_obj.ty,
616616
ast::return_val, []);
617617
let tpt = {kinds: ty_param_kinds(ty_params), ty: t_fn};
618618
cx.tcx.tcache.insert(local_def(ctor_id), tpt);
@@ -723,7 +723,7 @@ mod collect {
723723
let tag_t = ty::mk_tag(cx.tcx, tag_id, ty_param_tys);
724724
// FIXME: this will be different for constrained types
725725
result_ty =
726-
ty::mk_fn(cx.tcx, ast::proto_fn, args, tag_t,
726+
ty::mk_fn(cx.tcx, ast::proto_shared, args, tag_t,
727727
ast::return_val, []);
728728
}
729729
let tpt = {kinds: ty_param_kinds(ty_params), ty: result_ty};
@@ -793,10 +793,11 @@ mod collect {
793793
ty::mk_res(cx.tcx, local_def(it.id), t_arg.ty,
794794
mk_ty_params(cx, tps));
795795
let t_ctor =
796-
ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], t_res,
796+
ty::mk_fn(cx.tcx, ast::proto_shared, [t_arg], t_res,
797797
ast::return_val, []);
798798
let t_dtor =
799-
ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], ty::mk_nil(cx.tcx),
799+
ty::mk_fn(cx.tcx, ast::proto_shared, [t_arg],
800+
ty::mk_nil(cx.tcx),
800801
ast::return_val, []);
801802
write::ty_only(cx.tcx, it.id, t_res);
802803
write::ty_only(cx.tcx, ctor_id, t_ctor);
@@ -2091,7 +2092,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
20912092
constrs = constrs_;
20922093
}
20932094
ty::ty_native_fn(_, arg_tys_, rt_) {
2094-
proto = ast::proto_fn;
2095+
proto = ast::proto_shared;
20952096
arg_tys = arg_tys_;
20962097
rt = rt_;
20972098
cf = ast::return_val;
@@ -2116,7 +2117,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
21162117
fn lower_bound_proto(proto: ast::proto) -> ast::proto {
21172118
// FIXME: This is right for bare fns, possibly not others
21182119
alt proto {
2119-
ast::proto_bare. { ast::proto_fn }
2120+
ast::proto_bare. { ast::proto_shared }
21202121
_ { proto }
21212122
}
21222123
}
@@ -2567,7 +2568,7 @@ fn check_const(ccx: @crate_ctxt, _sp: span, e: @ast::expr, id: ast::node_id) {
25672568
let fcx: @fn_ctxt =
25682569
@{ret_ty: rty,
25692570
purity: ast::pure_fn,
2570-
proto: ast::proto_fn,
2571+
proto: ast::proto_shared,
25712572
var_bindings: ty::unify::mk_var_bindings(),
25722573
locals: new_int_hash::<int>(),
25732574
local_names: new_int_hash::<ast::ident>(),

src/comp/syntax/ast.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ tag _auth { auth_unsafe; }
105105

106106
tag proto {
107107
proto_iter;
108-
proto_fn;
108+
proto_shared;
109109
proto_block;
110+
// FIXME: Merge with proto_shared
110111
proto_closure;
111-
// Functions without an environment. Eventually, this will
112-
// merge with proto_fn.
113112
proto_bare;
114113
}
115114

src/comp/syntax/parse/parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ fn parse_item_res(p: parser, attrs: [ast::attribute]) -> @ast::item {
19011901
il: ast::il_normal,
19021902
cf: ast::return_val,
19031903
constraints: []};
1904-
let f = {decl: decl, proto: ast::proto_fn, body: dtor};
1904+
let f = {decl: decl, proto: ast::proto_shared, body: dtor};
19051905
ret mk_item(p, lo, dtor.span.hi, ident,
19061906
ast::item_res(f, p.get_id(), ty_params, p.get_id()), attrs);
19071907
}
@@ -2140,7 +2140,7 @@ fn parse_fn_item_proto(p: parser) -> ast::proto {
21402140
ast::proto_bare
21412141
} else if p.peek() == token::AT {
21422142
p.bump();
2143-
ast::proto_fn
2143+
ast::proto_shared
21442144
} else {
21452145
ast::proto_bare
21462146
}
@@ -2152,7 +2152,7 @@ fn parse_fn_ty_proto(p: parser) -> ast::proto {
21522152
ast::proto_bare
21532153
} else if p.peek() == token::AT {
21542154
p.bump();
2155-
ast::proto_fn
2155+
ast::proto_shared
21562156
} else {
21572157
ast::proto_bare
21582158
}
@@ -2164,7 +2164,7 @@ fn parse_fn_anon_proto(p: parser) -> ast::proto {
21642164
ast::proto_bare
21652165
} else if p.peek() == token::AT {
21662166
p.bump();
2167-
ast::proto_fn
2167+
ast::proto_shared
21682168
} else {
21692169
ast::proto_bare
21702170
}

src/comp/syntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ fn ast_fn_constrs_str(decl: ast::fn_decl, constrs: [@ast::constr]) -> str {
16431643

16441644
fn proto_to_str(p: ast::proto) -> str {
16451645
ret alt p {
1646-
ast::proto_fn. { "fn@" }
1646+
ast::proto_shared. { "fn@" }
16471647
ast::proto_iter. { "iter" }
16481648
ast::proto_block. { "block" }
16491649
ast::proto_closure. { "lambda" }

src/comp/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
129129
fn_to_str(cx, proto, none, inputs, output, cf, constrs)
130130
}
131131
ty_native_fn(_, inputs, output) {
132-
fn_to_str(cx, ast::proto_fn, none, inputs, output,
132+
fn_to_str(cx, ast::proto_shared, none, inputs, output,
133133
ast::return_val, [])
134134
}
135135
ty_obj(meths) {

0 commit comments

Comments
 (0)