diff options
Diffstat (limited to 'compiler/rustc_abi/src/lib.rs')
| -rw-r--r-- | compiler/rustc_abi/src/lib.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 7439af7aed3..6a2943da4a3 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -155,7 +155,7 @@ impl ReprOptions { } /// Returns `true` if this `#[repr()]` should inhibit union ABI optimisations. - pub fn inhibit_union_abi_opt(&self) -> bool { + pub fn inhibits_union_abi_opt(&self) -> bool { self.c() } } @@ -743,10 +743,20 @@ impl Align { } #[inline] + pub fn bytes_usize(self) -> usize { + self.bytes().try_into().unwrap() + } + + #[inline] pub fn bits(self) -> u64 { self.bytes() * 8 } + #[inline] + pub fn bits_usize(self) -> usize { + self.bits().try_into().unwrap() + } + /// Computes the best alignment possible for the given offset /// (the largest power of two that the offset is a multiple of). /// |
