Skip to content

Commit fba23d0

Browse files
committed
Disable field reordering for repr(int).
1 parent 748d354 commit fba23d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustc/ty/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2059,9 +2059,10 @@ impl ReprOptions {
20592059
}
20602060

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

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

0 commit comments

Comments
 (0)