@@ -95,16 +95,7 @@ fn type_of_fn(cx: @crate_ctxt, sp: span, proto: ast::proto,
95
95
// Arg 1: Env (closure-bindings / self-obj)
96
96
if is_method {
97
97
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) ] ; }
108
99
109
100
// Args >2: ty params, if not acquired via capture...
110
101
if !is_method {
@@ -3549,15 +3540,7 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
3549
3540
}
3550
3541
3551
3542
// 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] ;
3561
3544
3562
3545
// Copy in the type parameters.
3563
3546
let i: uint = 0 u;
@@ -3840,12 +3823,7 @@ fn trans_args(cx: @block_ctxt, outer_cx: @block_ctxt, llenv: ValueRef,
3840
3823
} else { llargs += [ llretslot] ; }
3841
3824
3842
3825
// 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] ;
3849
3827
3850
3828
// Args >2: ty_params ...
3851
3829
llargs += lltydescs;
@@ -5097,7 +5075,6 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
5097
5075
id : ast:: node_id , rstyle : ast:: ret_style )
5098
5076
-> @fn_ctxt {
5099
5077
let llbbs = mk_standard_basic_blocks ( llfndecl) ;
5100
- // FIXME: llenv is not correct for bare functions
5101
5078
ret @{ llfn : llfndecl,
5102
5079
llenv : llvm:: LLVMGetParam ( llfndecl, 1 u) ,
5103
5080
llretptr : llvm:: LLVMGetParam ( llfndecl, 0 u) ,
@@ -5127,13 +5104,6 @@ fn new_fn_ctxt(cx: @local_ctxt, sp: span, llfndecl: ValueRef) -> @fn_ctxt {
5127
5104
ret new_fn_ctxt_w_id ( cx, sp, llfndecl, -1 , ast:: return_val) ;
5128
5105
}
5129
5106
5130
- fn implicit_args_for_fn ( proto : ast:: proto ) -> uint {
5131
- alt proto {
5132
- ast : : proto_bare. { 1 u }
5133
- _ { 2 u }
5134
- }
5135
- }
5136
-
5137
5107
// NB: must keep 4 fns in sync:
5138
5108
//
5139
5109
// - type_of_fn
@@ -5151,8 +5121,10 @@ fn implicit_args_for_fn(proto: ast::proto) -> uint {
5151
5121
fn create_llargs_for_fn_args ( cx : @fn_ctxt , proto : ast:: proto ,
5152
5122
ty_self : option:: t < ty:: t > , ret_ty : ty:: t ,
5153
5123
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 = 2 u;
5156
5128
alt ty_self {
5157
5129
some( tt) { cx. llself = some :: < val_self_pair > ( { v: cx. llenv , t: tt} ) ; }
5158
5130
none. {
0 commit comments