@@ -94,10 +94,10 @@ impl MaybeSizedValue {
9494 }
9595}
9696
97- //Given an enum, struct, closure, or tuple, extracts fields.
98- //treats closures as a struct with one variant.
99- //`empty_if_no_variants` is a switch to deal with empty enums.
100- //if true, `variant_index` is disregarded and an empty Vec returned in this case.
97+ /// Given an enum, struct, closure, or tuple, extracts fields.
98+ /// Treats closures as a struct with one variant.
99+ /// `empty_if_no_variants` is a switch to deal with empty enums.
100+ /// If true, `variant_index` is disregarded and an empty Vec returned in this case.
101101fn compute_fields < ' a , ' tcx > ( cx : & CrateContext < ' a , ' tcx > , t : Ty < ' tcx > ,
102102 variant_index : usize ,
103103 empty_if_no_variants : bool ) -> Vec < Ty < ' tcx > > {
@@ -156,11 +156,9 @@ pub fn finish_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
156156 layout:: CEnum { .. } | layout:: General { .. }
157157 | layout:: UntaggedUnion { .. } | layout:: RawNullablePointer { .. } => { }
158158 layout:: Univariant { ..}
159- | layout:: StructWrappedNullablePointer { .. }
160- | layout:: Vector { .. } => {
159+ | layout:: StructWrappedNullablePointer { .. } => {
161160 let ( nonnull_variant, packed) = match * l {
162161 layout:: Univariant { ref variant, .. } => ( 0 , variant. packed ) ,
163- layout:: Vector { .. } => ( 0 , true ) ,
164162 layout:: StructWrappedNullablePointer { nndiscr, ref nonnull, .. } =>
165163 ( nndiscr, nonnull. packed ) ,
166164 _ => unreachable ! ( )
@@ -206,8 +204,8 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
206204 }
207205 }
208206 layout:: Univariant { ref variant, .. } => {
209- //note that this case also handles empty enums.
210- //Thus the true as the final parameter here.
207+ // Note that this case also handles empty enums.
208+ // Thus the true as the final parameter here.
211209 let fields = compute_fields ( cx, t, 0 , true ) ;
212210 match name {
213211 None => {
@@ -425,7 +423,7 @@ pub fn trans_case<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty<'tcx>, value: Disr)
425423 C_integral ( Type :: from_integer ( bcx. ccx ( ) , discr) , value. 0 , true )
426424 }
427425 layout:: RawNullablePointer { .. } |
428- layout:: StructWrappedNullablePointer { .. } => {
426+ layout:: StructWrappedNullablePointer { .. } => {
429427 assert ! ( value == Disr ( 0 ) || value == Disr ( 1 ) ) ;
430428 C_bool ( bcx. ccx ( ) , value != Disr ( 0 ) )
431429 }
@@ -774,10 +772,8 @@ fn build_const_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
774772 // offset of current value
775773 let mut offset = 0 ;
776774 let mut cfields = Vec :: new ( ) ;
777- for ( & val, target_offset) in
778- vals. iter ( ) . zip (
779- offset_after_field. iter ( ) . map ( |i| i. bytes ( ) )
780- ) {
775+ let target_offsets = offset_after_field. iter ( ) . map ( |i| i. bytes ( ) ) ;
776+ for ( & val, target_offset) in vals. iter ( ) . zip ( target_offsets) {
781777 assert ! ( !is_undef( val) ) ;
782778 cfields. push ( val) ;
783779 offset += machine:: llsize_of_alloc ( ccx, val_ty ( val) ) ;
0 commit comments