@@ -1623,15 +1623,13 @@ impl ImproperCTypesDefinitions {
16231623 cx : & LateContext < ' tcx > ,
16241624 ty : Ty < ' tcx > ,
16251625 ) -> bool {
1626+ assert ! ( cx. tcx. sess. target. os == "aix" ) ;
16261627 // Structs (under repr(C)) follow the power alignment rule if:
16271628 // - the first field of the struct is a floating-point type that
16281629 // is greater than 4-bytes, or
16291630 // - the first field of the struct is an aggregate whose
16301631 // recursively first field is a floating-point type greater than
16311632 // 4 bytes.
1632- if cx. tcx . sess . target . os != "aix" {
1633- return false ;
1634- }
16351633 if ty. is_floating_point ( ) && ty. primitive_size ( cx. tcx ) . bytes ( ) > 4 {
16361634 return true ;
16371635 } else if let Adt ( adt_def, _) = ty. kind ( )
@@ -1663,21 +1661,14 @@ impl ImproperCTypesDefinitions {
16631661 && !adt_def. all_fields ( ) . next ( ) . is_none ( )
16641662 {
16651663 let struct_variant_data = item. expect_struct ( ) . 1 ;
1666- for ( index , .. ) in struct_variant_data. fields ( ) . iter ( ) . enumerate ( ) {
1664+ for field_def in struct_variant_data. fields ( ) . iter ( ) . skip ( 1 ) {
16671665 // Struct fields (after the first field) are checked for the
16681666 // power alignment rule, as fields after the first are likely
16691667 // to be the fields that are misaligned.
1670- if index != 0 {
1671- let first_field_def = struct_variant_data. fields ( ) [ index] ;
1672- let def_id = first_field_def. def_id ;
1673- let ty = cx. tcx . type_of ( def_id) . instantiate_identity ( ) ;
1674- if self . check_arg_for_power_alignment ( cx, ty) {
1675- cx. emit_span_lint (
1676- USES_POWER_ALIGNMENT ,
1677- first_field_def. span ,
1678- UsesPowerAlignment ,
1679- ) ;
1680- }
1668+ let def_id = field_def. def_id ;
1669+ let ty = cx. tcx . type_of ( def_id) . instantiate_identity ( ) ;
1670+ if self . check_arg_for_power_alignment ( cx, ty) {
1671+ cx. emit_span_lint ( USES_POWER_ALIGNMENT , field_def. span , UsesPowerAlignment ) ;
16811672 }
16821673 }
16831674 }
0 commit comments