File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ pub struct StructLayoutTracker<'a> {
24
24
padding_count : usize ,
25
25
latest_field_layout : Option < Layout > ,
26
26
max_field_align : usize ,
27
+ has_bitfield : bool ,
27
28
last_field_was_bitfield : bool ,
28
29
}
29
30
@@ -103,6 +104,7 @@ impl<'a> StructLayoutTracker<'a> {
103
104
padding_count : 0 ,
104
105
latest_field_layout : None ,
105
106
max_field_align : 0 ,
107
+ has_bitfield : false ,
106
108
last_field_was_bitfield : false ,
107
109
}
108
110
}
@@ -145,6 +147,7 @@ impl<'a> StructLayoutTracker<'a> {
145
147
) ;
146
148
147
149
self . latest_field_layout = Some ( layout) ;
150
+ self . has_bitfield = true ;
148
151
self . last_field_was_bitfield = true ;
149
152
// NB: We intentionally don't update the max_field_align here, since our
150
153
// bitfields code doesn't necessarily guarantee it, so we need to
@@ -365,7 +368,7 @@ impl<'a> StructLayoutTracker<'a> {
365
368
return true ;
366
369
}
367
370
368
- if self . is_packed {
371
+ if self . is_packed && ! self . has_bitfield {
369
372
if self . max_field_align > layout. align {
370
373
return false ;
371
374
}
You can’t perform that action at this time.
0 commit comments