@@ -88,8 +88,8 @@ fn trans_obj(cx: @local_ctxt, sp: span, ob: ast::_obj, ctor_id: ast::node_id,
88
88
// typarams, and fields.
89
89
let llbox_ty: TypeRef = T_ptr ( T_empty_struct ( ) ) ;
90
90
91
- if std :: vec:: len :: < ast :: ty_param > ( ty_params) == 0 u &&
92
- std :: vec:: len :: < ty :: arg > ( arg_tys) == 0 u {
91
+ if vec:: len ( ty_params) == 0 u &&
92
+ vec:: len ( arg_tys) == 0 u {
93
93
// If the object we're translating has no fields or type parameters,
94
94
// there's not much to do.
95
95
@@ -124,7 +124,7 @@ fn trans_obj(cx: @local_ctxt, sp: span, ob: ast::_obj, ctor_id: ast::node_id,
124
124
let body_tydesc =
125
125
GEP_tup_like ( bcx, body_ty, body, [ 0 , abi:: obj_body_elt_tydesc] ) ;
126
126
bcx = body_tydesc. bcx ;
127
- let ti = none :: < @ tydesc_info > ;
127
+ let ti = none;
128
128
129
129
let r =
130
130
GEP_tup_like ( bcx, body_ty, body, [ 0 , abi:: obj_body_elt_typarams] ) ;
@@ -229,7 +229,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: span, anon_obj: ast::anon_obj,
229
229
// methods, not inner ones.
230
230
let wrapper_obj: ast:: _obj =
231
231
{ fields:
232
- std :: vec:: map ( ast_util:: obj_field_from_anon_obj_field,
232
+ vec:: map ( ast_util:: obj_field_from_anon_obj_field,
233
233
additional_fields) ,
234
234
methods: anon_obj. methods } ;
235
235
@@ -287,7 +287,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: span, anon_obj: ast::anon_obj,
287
287
// typarams, fields, and a pointer to our inner_obj.
288
288
let llbox_ty: TypeRef = T_ptr ( T_empty_struct ( ) ) ;
289
289
290
- if std :: vec:: len :: < ast :: anon_obj_field > ( additional_fields) == 0 u &&
290
+ if vec:: len ( additional_fields) == 0 u &&
291
291
anon_obj. inner_obj == none {
292
292
293
293
// If the object we're translating has no fields and no inner_obj,
@@ -317,7 +317,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: span, anon_obj: ast::anon_obj,
317
317
let body_tydesc =
318
318
GEP_tup_like ( bcx, body_ty, body, [ 0 , abi:: obj_body_elt_tydesc] ) ;
319
319
bcx = body_tydesc. bcx ;
320
- let ti = none :: < @ tydesc_info > ;
320
+ let ti = none;
321
321
let body_td = get_tydesc ( bcx, body_ty, true , tps_normal, ti) . result ;
322
322
lazily_emit_tydesc_glue ( bcx, abi:: tydesc_field_drop_glue, ti) ;
323
323
lazily_emit_tydesc_glue ( bcx, abi:: tydesc_field_free_glue, ti) ;
@@ -447,8 +447,7 @@ fn create_vtbl(cx: @local_ctxt, sp: span, outer_obj_ty: ty::t, ob: ast::_obj,
447
447
448
448
// Sort and process all the methods.
449
449
let meths =
450
- std:: sort:: merge_sort :: < @ast:: method > ( bind ast_mthd_lteq ( _, _) ,
451
- ob. methods ) ;
450
+ std:: sort:: merge_sort ( bind ast_mthd_lteq ( _, _) , ob. methods ) ;
452
451
453
452
for m: @ast:: method in meths {
454
453
llmethods +=
@@ -483,16 +482,15 @@ fn create_vtbl(cx: @local_ctxt, sp: span, outer_obj_ty: ty::t, ob: ast::_obj,
483
482
// Filter out any methods that we don't need forwarding slots for
484
483
// because they're being overridden.
485
484
let f = bind filtering_fn ( cx, _, ob. methods ) ;
486
- meths = std :: vec:: filter_map :: < vtbl_mthd , vtbl_mthd > ( f, meths) ;
485
+ meths = vec:: filter_map ( f, meths) ;
487
486
488
487
// And now add the additional ones, both overriding ones and entirely
489
488
// new ones. These will just be normal methods.
490
489
for m: @ast:: method in ob. methods { meths += [ normal_mthd ( m) ] ; }
491
490
492
491
// Sort all the methods and process them.
493
492
meths =
494
- std:: sort:: merge_sort :: < vtbl_mthd > ( bind vtbl_mthd_lteq ( _, _) ,
495
- meths) ;
493
+ std:: sort:: merge_sort ( bind vtbl_mthd_lteq ( _, _) , meths) ;
496
494
497
495
// To create forwarding methods, we'll need a "backwarding" vtbl. See
498
496
// create_backwarding_vtbl and process_bkwding_method for details.
@@ -599,9 +597,7 @@ fn process_bkwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
599
597
mangle_internal_name_by_path_and_seq ( mcx. ccx , mcx. path , fn_name) ;
600
598
601
599
// Get the backwarding function's type and declare it.
602
- let llbackwarding_fn_ty: TypeRef =
603
- type_of_fn_full ( cx. ccx , sp, m. proto , true , m. inputs , m. output ,
604
- std:: vec:: len :: < ast:: ty_param > ( ty_params) ) ;
600
+ let llbackwarding_fn_ty: TypeRef = type_of_meth ( cx. ccx , sp, m, ty_params) ;
605
601
let llbackwarding_fn: ValueRef =
606
602
decl_internal_fastcall_fn ( cx. ccx . llmod , s, llbackwarding_fn_ty) ;
607
603
@@ -661,12 +657,7 @@ fn process_bkwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
661
657
GEP ( bcx, llouter_obj_vtbl, [ C_int ( 0 ) , C_int ( ix as int ) ] ) ;
662
658
663
659
// Set up the outer method to be called.
664
- let outer_mthd_ty = ty:: method_ty_to_fn_ty ( cx. ccx . tcx , * m) ;
665
- let llouter_mthd_ty =
666
- type_of_fn_full ( bcx_ccx ( bcx) , sp,
667
- ty:: ty_fn_proto ( bcx_tcx ( bcx) , outer_mthd_ty) , true ,
668
- m. inputs , m. output ,
669
- std:: vec:: len :: < ast:: ty_param > ( ty_params) ) ;
660
+ let llouter_mthd_ty = type_of_meth ( bcx_ccx ( bcx) , sp, m, ty_params) ;
670
661
llouter_mthd =
671
662
PointerCast ( bcx, llouter_mthd, T_ptr ( T_ptr ( llouter_mthd_ty) ) ) ;
672
663
llouter_mthd = Load ( bcx, llouter_mthd) ;
@@ -723,9 +714,7 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
723
714
mangle_internal_name_by_path_and_seq ( mcx. ccx , mcx. path , fn_name) ;
724
715
725
716
// Get the forwarding function's type and declare it.
726
- let llforwarding_fn_ty: TypeRef =
727
- type_of_fn_full ( cx. ccx , sp, m. proto , true , m. inputs , m. output ,
728
- std:: vec:: len :: < ast:: ty_param > ( ty_params) ) ;
717
+ let llforwarding_fn_ty = type_of_meth ( cx. ccx , sp, m, ty_params) ;
729
718
let llforwarding_fn: ValueRef =
730
719
decl_internal_fastcall_fn ( cx. ccx . llmod , s, llforwarding_fn_ty) ;
731
720
@@ -819,12 +808,7 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
819
808
GEP ( bcx, llinner_obj_vtbl, [ C_int ( 0 ) , C_int ( ix as int ) ] ) ;
820
809
821
810
// Set up the original method to be called.
822
- let orig_mthd_ty = ty:: method_ty_to_fn_ty ( cx. ccx . tcx , * m) ;
823
- let llorig_mthd_ty =
824
- type_of_fn_full ( bcx_ccx ( bcx) , sp,
825
- ty:: ty_fn_proto ( bcx_tcx ( bcx) , orig_mthd_ty) , true ,
826
- m. inputs , m. output ,
827
- std:: vec:: len :: < ast:: ty_param > ( ty_params) ) ;
811
+ let llorig_mthd_ty = type_of_meth ( bcx_ccx ( bcx) , sp, m, ty_params) ;
828
812
llorig_mthd = PointerCast ( bcx, llorig_mthd, T_ptr ( T_ptr ( llorig_mthd_ty) ) ) ;
829
813
llorig_mthd = Load ( bcx, llorig_mthd) ;
830
814
@@ -899,7 +883,7 @@ fn process_normal_mthd(cx: @local_ctxt, m: @ast::method, self_ty: ty::t,
899
883
ty:: ty_fn ( proto, inputs, output, _, _) {
900
884
llfnty =
901
885
type_of_fn_full ( cx. ccx , m. span , proto, true , inputs, output,
902
- std :: vec:: len :: < ast :: ty_param > ( ty_params) ) ;
886
+ vec:: len ( ty_params) ) ;
903
887
}
904
888
}
905
889
let mcx: @local_ctxt =
@@ -946,6 +930,13 @@ fn populate_self_stack(bcx: @block_ctxt, self_stack: ValueRef,
946
930
947
931
ret self_stack;
948
932
}
933
+
934
+ fn type_of_meth ( ccx : @crate_ctxt , sp : span , m : @ty:: method ,
935
+ tps : [ ast:: ty_param ] ) -> TypeRef {
936
+ type_of_fn_full ( ccx, sp, m. proto , true , m. inputs , m. output ,
937
+ vec:: len ( tps) )
938
+ }
939
+
949
940
//
950
941
// Local Variables:
951
942
// mode: rust
0 commit comments