@@ -557,8 +557,6 @@ impl<'a, 'gcx, 'tcx> Struct {
557
557
min_size : Size :: from_bytes ( 0 ) ,
558
558
} ;
559
559
560
- if fields. len ( ) == 0 { return Ok ( ret) } ;
561
-
562
560
// Anything with ReprExtern or ReprPacked doesn't optimize.
563
561
// Neither do 1-member and 2-member structs.
564
562
// In addition, code in trans assume that 2-element structs can become pairs.
@@ -590,9 +588,9 @@ impl<'a, 'gcx, 'tcx> Struct {
590
588
let mut inverse_memory_index: Vec < u32 > = ( 0 ..fields. len ( ) as u32 ) . collect ( ) ;
591
589
592
590
if optimize {
593
- let start = if let StructKind :: EnumVariant = kind { 1 } else { 0 } ;
591
+ let start = if let StructKind :: EnumVariant = kind { 1 } else { 0 } ;
594
592
let end = if let StructKind :: MaybeUnsizedUnivariant = kind {
595
- fields. len ( ) - 1
593
+ fields. len ( ) - 1
596
594
} else {
597
595
fields. len ( )
598
596
} ;
@@ -717,12 +715,12 @@ impl<'a, 'gcx, 'tcx> Struct {
717
715
718
716
/// Find the path leading to a non-zero leaf field, starting from
719
717
/// the given type and recursing through aggregates.
720
- /// The tuple is `(path, source_path)1 ,
718
+ /// The tuple is `(path, source_path)` ,
721
719
/// where `path` is in memory order and `source_path` in source order.
722
720
// FIXME(eddyb) track value ranges and traverse already optimized enums.
723
721
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 > > {
726
724
let tcx = infcx. tcx . global_tcx ( ) ;
727
725
match ( ty. layout ( infcx) ?, & ty. sty ) {
728
726
( & Scalar { non_zero : true , .. } , _) |
@@ -792,7 +790,7 @@ impl<'a, 'gcx, 'tcx> Struct {
792
790
793
791
/// Find the path leading to a non-zero leaf field, starting from
794
792
/// 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.
796
794
/// `path` is translated to memory order. `source_path` is not.
797
795
fn non_zero_field_paths < I > ( infcx : & InferCtxt < ' a , ' gcx , ' tcx > ,
798
796
fields : I ,
@@ -1363,7 +1361,7 @@ impl<'a, 'gcx, 'tcx> Layout {
1363
1361
for i in variant. offsets . iter_mut ( ) {
1364
1362
// The first field is the discrimminant, at offset 0.
1365
1363
// 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 ) {
1367
1365
* i = new_ity_size;
1368
1366
}
1369
1367
}
0 commit comments