Skip to content

Commit c0d3d31

Browse files
committed
---
yaml --- r: 5875 b: refs/heads/master c: 3bb020a h: refs/heads/master i: 5873: 92d49fb 5871: 4b3f7ec v: v3
1 parent eda51dc commit c0d3d31

File tree

2 files changed

+8
-36
lines changed

2 files changed

+8
-36
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 070c39ca1d4792a96f08d19c22378d5b5b019f02
2+
refs/heads/master: 3bb020aaf8ae2947bbfc26e589c77967b922a215

trunk/src/comp/middle/trans.rs

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,7 @@ fn type_of_fn(cx: @crate_ctxt, sp: span, proto: ast::proto,
9595
// Arg 1: Env (closure-bindings / self-obj)
9696
if is_method {
9797
atys += [T_ptr(cx.rust_object_type)];
98-
} else {
99-
alt proto {
100-
ast::proto_bare. {
101-
// Bare functions have no environment
102-
}
103-
_ {
104-
atys += [T_opaque_closure_ptr(*cx)];
105-
}
106-
}
107-
}
98+
} else { atys += [T_opaque_closure_ptr(*cx)]; }
10899

109100
// Args >2: ty params, if not acquired via capture...
110101
if !is_method {
@@ -3549,15 +3540,7 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
35493540
}
35503541

35513542
// Set up the three implicit arguments to the thunk.
3552-
let llargs: [ValueRef] = alt ty::ty_fn_proto(ccx.tcx, outgoing_fty) {
3553-
ast::proto_bare. {
3554-
// Bare functions don't take an environment
3555-
[llretptr]
3556-
}
3557-
_ {
3558-
[llretptr, lltargetenv]
3559-
}
3560-
};
3543+
let llargs: [ValueRef] = [llretptr, lltargetenv];
35613544

35623545
// Copy in the type parameters.
35633546
let i: uint = 0u;
@@ -3840,12 +3823,7 @@ fn trans_args(cx: @block_ctxt, outer_cx: @block_ctxt, llenv: ValueRef,
38403823
} else { llargs += [llretslot]; }
38413824

38423825
// Arg 1: Env (closure-bindings / self-obj)
3843-
alt ty::ty_fn_proto(tcx, fn_ty) {
3844-
ast::proto_bare. { }
3845-
_ {
3846-
llargs += [llenv];
3847-
}
3848-
}
3826+
llargs += [llenv];
38493827

38503828
// Args >2: ty_params ...
38513829
llargs += lltydescs;
@@ -5097,7 +5075,6 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
50975075
id: ast::node_id, rstyle: ast::ret_style)
50985076
-> @fn_ctxt {
50995077
let llbbs = mk_standard_basic_blocks(llfndecl);
5100-
// FIXME: llenv is not correct for bare functions
51015078
ret @{llfn: llfndecl,
51025079
llenv: llvm::LLVMGetParam(llfndecl, 1u),
51035080
llretptr: llvm::LLVMGetParam(llfndecl, 0u),
@@ -5127,13 +5104,6 @@ fn new_fn_ctxt(cx: @local_ctxt, sp: span, llfndecl: ValueRef) -> @fn_ctxt {
51275104
ret new_fn_ctxt_w_id(cx, sp, llfndecl, -1, ast::return_val);
51285105
}
51295106

5130-
fn implicit_args_for_fn(proto: ast::proto) -> uint {
5131-
alt proto {
5132-
ast::proto_bare. { 1u }
5133-
_ { 2u }
5134-
}
5135-
}
5136-
51375107
// NB: must keep 4 fns in sync:
51385108
//
51395109
// - type_of_fn
@@ -5151,8 +5121,10 @@ fn implicit_args_for_fn(proto: ast::proto) -> uint {
51515121
fn create_llargs_for_fn_args(cx: @fn_ctxt, proto: ast::proto,
51525122
ty_self: option::t<ty::t>, ret_ty: ty::t,
51535123
args: [ast::arg], ty_params: [ast::ty_param]) {
5154-
// Skip the implicit arguments
5155-
let arg_n = implicit_args_for_fn(proto);
5124+
// Skip the implicit arguments 0, and 1. TODO: Pull out 2u and define
5125+
// it as a constant, since we're using it in several places in trans this
5126+
// way.
5127+
let arg_n = 2u;
51565128
alt ty_self {
51575129
some(tt) { cx.llself = some::<val_self_pair>({v: cx.llenv, t: tt}); }
51585130
none. {

0 commit comments

Comments
 (0)