@@ -136,9 +136,9 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr {
136
136
}
137
137
ty:: ty_struct( def_id, ref substs) => {
138
138
let fields = ty:: lookup_struct_fields ( cx. tcx ( ) , def_id) ;
139
- let mut ftys = fields. map ( |field| {
139
+ let mut ftys = fields. iter ( ) . map ( |field| {
140
140
ty:: lookup_field_type ( cx. tcx ( ) , def_id, field. id , substs)
141
- } ) ;
141
+ } ) . collect :: < Vec < _ > > ( ) ;
142
142
let packed = ty:: lookup_packed ( cx. tcx ( ) , def_id) ;
143
143
let dtor = ty:: ty_dtor ( cx. tcx ( ) , def_id) . has_drop_flag ( ) ;
144
144
if dtor { ftys. push ( ty:: mk_bool ( ) ) ; }
@@ -158,7 +158,7 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr {
158
158
159
159
if cases. iter ( ) . all ( |c| c. tys . len ( ) == 0 ) {
160
160
// All bodies empty -> intlike
161
- let discrs = cases. map ( |c| c. discr ) ;
161
+ let discrs: Vec < u64 > = cases. iter ( ) . map ( |c| c. discr ) . collect ( ) ;
162
162
let bounds = IntBounds {
163
163
ulo : * discrs. iter ( ) . min ( ) . unwrap ( ) ,
164
164
uhi : * discrs. iter ( ) . max ( ) . unwrap ( ) ,
@@ -218,12 +218,12 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr {
218
218
let bounds = IntBounds { ulo : 0 , uhi : ( cases. len ( ) - 1 ) as u64 ,
219
219
slo : 0 , shi : ( cases. len ( ) - 1 ) as i64 } ;
220
220
let ity = range_to_inttype ( cx, hint, & bounds) ;
221
- return General ( ity, cases. map ( |c| {
221
+ return General ( ity, cases. iter ( ) . map ( |c| {
222
222
let discr = vec ! ( ty_of_inttype( ity) ) ;
223
223
mk_struct ( cx,
224
224
vec:: append ( discr, c. tys . as_slice ( ) ) . as_slice ( ) ,
225
225
false )
226
- } ) )
226
+ } ) . collect ( ) )
227
227
}
228
228
_ => cx. sess ( ) . bug ( "adt::represent_type called on non-ADT type" )
229
229
}
@@ -270,18 +270,18 @@ impl Case {
270
270
}
271
271
272
272
fn get_cases ( tcx : & ty:: ctxt , def_id : ast:: DefId , substs : & ty:: substs ) -> Vec < Case > {
273
- ty:: enum_variants ( tcx, def_id) . map ( |vi| {
274
- let arg_tys = vi. args . map ( |& raw_ty| {
273
+ ty:: enum_variants ( tcx, def_id) . iter ( ) . map ( |vi| {
274
+ let arg_tys = vi. args . iter ( ) . map ( |& raw_ty| {
275
275
ty:: subst ( tcx, substs, raw_ty)
276
- } ) ;
276
+ } ) . collect ( ) ;
277
277
Case { discr : vi. disr_val , tys : arg_tys }
278
- } )
278
+ } ) . collect ( )
279
279
}
280
280
281
281
282
282
fn mk_struct ( cx : & CrateContext , tys : & [ ty:: t ] , packed : bool ) -> Struct {
283
- let lltys = tys. map ( |& ty| type_of:: sizing_type_of ( cx, ty) ) ;
284
- let llty_rec = Type :: struct_ ( cx, lltys, packed) ;
283
+ let lltys = tys. iter ( ) . map ( |& ty| type_of:: sizing_type_of ( cx, ty) ) . collect :: < Vec < _ > > ( ) ;
284
+ let llty_rec = Type :: struct_ ( cx, lltys. as_slice ( ) , packed) ;
285
285
Struct {
286
286
size : machine:: llsize_of_alloc ( cx, llty_rec) /*bad*/ as u64 ,
287
287
align : machine:: llalign_of_min ( cx, llty_rec) /*bad*/ as u64 ,
@@ -464,9 +464,9 @@ fn generic_type_of(cx: &CrateContext, r: &Repr, name: Option<&str>, sizing: bool
464
464
465
465
fn struct_llfields ( cx : & CrateContext , st : & Struct , sizing : bool ) -> Vec < Type > {
466
466
if sizing {
467
- st. fields . map ( |& ty| type_of:: sizing_type_of ( cx, ty) )
467
+ st. fields . iter ( ) . map ( |& ty| type_of:: sizing_type_of ( cx, ty) ) . collect ( )
468
468
} else {
469
- st. fields . map ( |& ty| type_of:: type_of ( cx, ty) )
469
+ st. fields . iter ( ) . map ( |& ty| type_of:: type_of ( cx, ty) ) . collect ( )
470
470
}
471
471
}
472
472
@@ -700,7 +700,7 @@ fn struct_field_ptr(bcx: &Block, st: &Struct, val: ValueRef, ix: uint,
700
700
let ccx = bcx. ccx ( ) ;
701
701
702
702
let val = if needs_cast {
703
- let fields = st. fields . map ( |& ty| type_of:: type_of ( ccx, ty) ) ;
703
+ let fields = st. fields . iter ( ) . map ( |& ty| type_of:: type_of ( ccx, ty) ) . collect :: < Vec < _ > > ( ) ;
704
704
let real_ty = Type :: struct_ ( ccx, fields. as_slice ( ) , st. packed ) ;
705
705
PointerCast ( bcx, val, real_ty. ptr_to ( ) )
706
706
} else {
@@ -773,11 +773,11 @@ pub fn trans_const(ccx: &CrateContext, r: &Repr, discr: Disr,
773
773
vals) . as_slice ( ) ,
774
774
false )
775
775
} else {
776
- let vals = nonnull. fields . map ( |& ty| {
776
+ let vals = nonnull. fields . iter ( ) . map ( |& ty| {
777
777
// Always use null even if it's not the `ptrfield`th
778
778
// field; see #8506.
779
779
C_null ( type_of:: sizing_type_of ( ccx, ty) )
780
- } ) . move_iter ( ) . collect :: < Vec < ValueRef > > ( ) ;
780
+ } ) . collect :: < Vec < ValueRef > > ( ) ;
781
781
C_struct ( ccx, build_const_struct ( ccx,
782
782
nonnull,
783
783
vals. as_slice ( ) ) . as_slice ( ) ,
0 commit comments