Skip to content

Commit

Permalink
Disable field reordering for repr(int).
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Dec 16, 2018
1 parent 748d354 commit fba23d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2059,9 +2059,10 @@ impl ReprOptions {
}

/// Returns `true` if this `#[repr()]` should inhibit struct field reordering
/// optimizations, such as with repr(C) or repr(packed(1)).
/// optimizations, such as with repr(C), repr(packed(1)), or repr(<int>).
pub fn inhibit_struct_field_reordering_opt(&self) -> bool {
!(self.flags & ReprFlags::IS_UNOPTIMISABLE).is_empty() || (self.pack == 1)
self.flags.intersects(ReprFlags::IS_UNOPTIMISABLE) || self.pack == 1 ||
self.int.is_some()
}

/// Returns true if this `#[repr()]` should inhibit union abi optimisations
Expand Down

0 comments on commit fba23d0

Please sign in to comment.