diff options
| author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-12-16 19:59:42 +0100 |
|---|---|---|
| committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-12-16 20:06:53 +0100 |
| commit | fba23d01d16db8b83b2415bc538d2a850fcf24da (patch) | |
| tree | ec17db48f0c62b4fc1aa63e8888360a032f69d6f /src | |
| parent | 748d354af3145d4292ea84142f73bb8114e3db12 (diff) | |
| download | rust-fba23d01d16db8b83b2415bc538d2a850fcf24da.tar.gz rust-fba23d01d16db8b83b2415bc538d2a850fcf24da.zip | |
Disable field reordering for repr(int).
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/ty/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index a1fc949137d..634df0194b0 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -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 |
