@@ -74,11 +74,11 @@ fn type_of_explicit_args(cx: @crate_ctxt, sp: span, inputs: [ty::arg]) ->
74
74
// - trans_args
75
75
fn type_of_fn( cx : @crate_ctxt , sp : span , proto : ast:: proto ,
76
76
is_method : bool , ret_ref : bool , inputs : [ ty:: arg ] ,
77
- output : ty:: t , ty_param_count : uint ) -> TypeRef {
77
+ output : ty:: t , ty_param_count : uint )
78
+ : non_ty_var ( cx , output ) -> TypeRef {
78
79
let atys: [ TypeRef ] = [ ] ;
79
80
80
81
// Arg 0: Output pointer.
81
- check non_ty_var( cx, output) ;
82
82
let out_ty = T_ptr ( type_of_inner ( cx, sp, output) ) ;
83
83
atys += [ ret_ref ? T_ptr ( out_ty) : out_ty] ;
84
84
@@ -2073,6 +2073,7 @@ fn move_val(cx: @block_ctxt, action: copy_action, dst: ValueRef,
2073
2073
// If we're here, it must be a temporary.
2074
2074
ret revoke_clean ( cx, src_val, t) ;
2075
2075
}
2076
+ /* FIXME: suggests a type constraint */
2076
2077
bcx_ccx ( cx) . sess . bug ( "unexpected type in trans::move_val: " +
2077
2078
ty_to_str ( tcx, t) ) ;
2078
2079
}
@@ -2999,12 +3000,18 @@ fn trans_field(cx: @block_ctxt, sp: span, v: ValueRef, t0: ty::t,
2999
3000
3000
3001
let v = GEP ( r. bcx , vtbl, [ C_int ( 0 ) , C_int ( ix as int ) ] ) ;
3001
3002
let tcx = bcx_tcx ( cx) ;
3003
+ let ccx = bcx_ccx ( cx) ;
3004
+
3002
3005
let fn_ty: ty:: t = ty:: method_ty_to_fn_ty ( tcx, methods[ ix] ) ;
3006
+ let ret_ty = ty:: ty_fn_ret ( tcx, fn_ty) ;
3003
3007
let ret_ref = ast_util:: ret_by_ref ( ty:: ty_fn_ret_style ( tcx, fn_ty) ) ;
3008
+ // FIXME: constrain ty_obj?
3009
+ check non_ty_var( ccx, ret_ty) ;
3010
+
3004
3011
let ll_fn_ty =
3005
- type_of_fn ( bcx_ccx ( cx ) , sp, ty:: ty_fn_proto ( tcx, fn_ty) ,
3012
+ type_of_fn ( ccx , sp, ty:: ty_fn_proto ( tcx, fn_ty) ,
3006
3013
true , ret_ref, ty:: ty_fn_args ( tcx, fn_ty) ,
3007
- ty :: ty_fn_ret ( tcx , fn_ty ) , 0 u) ;
3014
+ ret_ty , 0 u) ;
3008
3015
v = PointerCast ( r. bcx , v, T_ptr ( T_ptr ( ll_fn_ty) ) ) ;
3009
3016
let lvo = lval_mem ( r. bcx , v) ;
3010
3017
ret { llobj : some :: < ValueRef > ( r. val ) with lvo} ;
@@ -4581,7 +4588,7 @@ fn trans_stmt(cx: @block_ctxt, s: ast::stmt) -> result {
4581
4588
}
4582
4589
_ { bcx_ccx( cx) . sess . unimpl ( "stmt variant" ) ; }
4583
4590
}
4584
- ret rslt( bcx, C_nil ( ) ) ;
4591
+ rslt ( bcx, C_nil ( ) )
4585
4592
}
4586
4593
4587
4594
// You probably don't want to use this one. See the
@@ -5438,7 +5445,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
5438
5445
let vecarg_ty: ty:: arg =
5439
5446
{ mode: ast:: by_ref,
5440
5447
ty: ty:: mk_vec ( ccx. tcx , { ty: unit_ty, mut: ast:: imm} ) } ;
5441
- // FIXME: mk_nil should have a post condition
5448
+ // FIXME: mk_nil should have a postcondition
5442
5449
let nt = ty:: mk_nil ( ccx. tcx ) ;
5443
5450
check non_ty_var( ccx, nt) ;
5444
5451
0 commit comments