File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -1623,15 +1623,13 @@ impl ImproperCTypesDefinitions {
1623
1623
cx : & LateContext < ' tcx > ,
1624
1624
ty : Ty < ' tcx > ,
1625
1625
) -> bool {
1626
+ assert ! ( cx. tcx. sess. target. os == "aix" ) ;
1626
1627
// Structs (under repr(C)) follow the power alignment rule if:
1627
1628
// - the first field of the struct is a floating-point type that
1628
1629
// is greater than 4-bytes, or
1629
1630
// - the first field of the struct is an aggregate whose
1630
1631
// recursively first field is a floating-point type greater than
1631
1632
// 4 bytes.
1632
- if cx. tcx . sess . target . os != "aix" {
1633
- return false ;
1634
- }
1635
1633
if ty. is_floating_point ( ) && ty. primitive_size ( cx. tcx ) . bytes ( ) > 4 {
1636
1634
return true ;
1637
1635
} else if let Adt ( adt_def, _) = ty. kind ( )
@@ -1668,15 +1666,11 @@ impl ImproperCTypesDefinitions {
1668
1666
// power alignment rule, as fields after the first are likely
1669
1667
// to be the fields that are misaligned.
1670
1668
if index != 0 {
1671
- let first_field_def = struct_variant_data. fields ( ) [ index] ;
1672
- let def_id = first_field_def . def_id ;
1669
+ let field_def = struct_variant_data. fields ( ) [ index] ;
1670
+ let def_id = field_def . def_id ;
1673
1671
let ty = cx. tcx . type_of ( def_id) . instantiate_identity ( ) ;
1674
1672
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
- ) ;
1673
+ cx. emit_span_lint ( USES_POWER_ALIGNMENT , field_def. span , UsesPowerAlignment ) ;
1680
1674
}
1681
1675
}
1682
1676
}
You can’t perform that action at this time.
0 commit comments