File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 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> {
2424 padding_count : usize ,
2525 latest_field_layout : Option < Layout > ,
2626 max_field_align : usize ,
27+ has_bitfield : bool ,
2728 last_field_was_bitfield : bool ,
2829}
2930
@@ -103,6 +104,7 @@ impl<'a> StructLayoutTracker<'a> {
103104 padding_count : 0 ,
104105 latest_field_layout : None ,
105106 max_field_align : 0 ,
107+ has_bitfield : false ,
106108 last_field_was_bitfield : false ,
107109 }
108110 }
@@ -145,6 +147,7 @@ impl<'a> StructLayoutTracker<'a> {
145147 ) ;
146148
147149 self . latest_field_layout = Some ( layout) ;
150+ self . has_bitfield = true ;
148151 self . last_field_was_bitfield = true ;
149152 // NB: We intentionally don't update the max_field_align here, since our
150153 // bitfields code doesn't necessarily guarantee it, so we need to
@@ -365,7 +368,7 @@ impl<'a> StructLayoutTracker<'a> {
365368 return true ;
366369 }
367370
368- if self . is_packed {
371+ if self . is_packed && ! self . has_bitfield {
369372 if self . max_field_align > layout. align {
370373 return false ;
371374 }
You can’t perform that action at this time.
0 commit comments