Skip to content

Commit

Permalink
don't inhibit random field reordering on repr(packed(1))
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 21, 2024
1 parent e875391 commit ea7545b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,8 @@ impl ReprOptions {
}

/// Returns `true` if this `#[repr()]` should inhibit struct field reordering
/// optimizations, such as with `repr(C)`, `repr(packed(1))`, or `repr(<int>)`.
/// optimizations, such as with `repr(C)` or `repr(<int>)`.
pub fn inhibit_struct_field_reordering_opt(&self) -> bool {
if let Some(pack) = self.pack {
if pack.bytes() == 1 {
return true;
}
}

self.flags.intersects(ReprFlags::IS_UNOPTIMISABLE) || self.int.is_some()
}

Expand Down

0 comments on commit ea7545b

Please sign in to comment.