@@ -557,8 +557,6 @@ impl<'a, 'gcx, 'tcx> Struct {
557557 min_size : Size :: from_bytes ( 0 ) ,
558558 } ;
559559
560- if fields. len ( ) == 0 { return Ok ( ret) } ;
561-
562560 // Anything with ReprExtern or ReprPacked doesn't optimize.
563561 // Neither do 1-member and 2-member structs.
564562 // In addition, code in trans assume that 2-element structs can become pairs.
@@ -590,9 +588,9 @@ impl<'a, 'gcx, 'tcx> Struct {
590588 let mut inverse_memory_index: Vec < u32 > = ( 0 ..fields. len ( ) as u32 ) . collect ( ) ;
591589
592590 if optimize {
593- let start = if let StructKind :: EnumVariant = kind { 1 } else { 0 } ;
591+ let start = if let StructKind :: EnumVariant = kind { 1 } else { 0 } ;
594592 let end = if let StructKind :: MaybeUnsizedUnivariant = kind {
595- fields. len ( ) - 1
593+ fields. len ( ) - 1
596594 } else {
597595 fields. len ( )
598596 } ;
@@ -717,12 +715,12 @@ impl<'a, 'gcx, 'tcx> Struct {
717715
718716 /// Find the path leading to a non-zero leaf field, starting from
719717 /// the given type and recursing through aggregates.
720- /// The tuple is `(path, source_path)1 ,
718+ /// The tuple is `(path, source_path)` ,
721719 /// where `path` is in memory order and `source_path` in source order.
722720 // FIXME(eddyb) track value ranges and traverse already optimized enums.
723721 fn non_zero_field_in_type ( infcx : & InferCtxt < ' a , ' gcx , ' tcx > ,
724- ty : Ty < ' gcx > )
725- -> Result < Option < ( FieldPath , FieldPath ) > , LayoutError < ' gcx > > {
722+ ty : Ty < ' gcx > )
723+ -> Result < Option < ( FieldPath , FieldPath ) > , LayoutError < ' gcx > > {
726724 let tcx = infcx. tcx . global_tcx ( ) ;
727725 match ( ty. layout ( infcx) ?, & ty. sty ) {
728726 ( & Scalar { non_zero : true , .. } , _) |
@@ -792,7 +790,7 @@ impl<'a, 'gcx, 'tcx> Struct {
792790
793791 /// Find the path leading to a non-zero leaf field, starting from
794792 /// the given set of fields and recursing through aggregates.
795- // / Returns Some((path, source_path)) on success.
793+ /// Returns Some((path, source_path)) on success.
796794 /// `path` is translated to memory order. `source_path` is not.
797795 fn non_zero_field_paths < I > ( infcx : & InferCtxt < ' a , ' gcx , ' tcx > ,
798796 fields : I ,
@@ -1363,7 +1361,7 @@ impl<'a, 'gcx, 'tcx> Layout {
13631361 for i in variant. offsets . iter_mut ( ) {
13641362 // The first field is the discrimminant, at offset 0.
13651363 // These aren't in order, and we need to skip it.
1366- if * i <= old_ity_size && * i > Size :: from_bytes ( 0 ) {
1364+ if * i <= old_ity_size && * i > Size :: from_bytes ( 0 ) {
13671365 * i = new_ity_size;
13681366 }
13691367 }
0 commit comments