diff --git a/compiler/rustc_middle/src/ty/consts/int.rs b/compiler/rustc_middle/src/ty/consts/int.rs index 901b7571abb..fd5f9d6ff1c 100644 --- a/compiler/rustc_middle/src/ty/consts/int.rs +++ b/compiler/rustc_middle/src/ty/consts/int.rs @@ -225,10 +225,9 @@ impl ScalarInt { #[inline] pub fn assert_bits(self, target_size: Size) -> u128 { - assert_ne!(target_size.bytes(), 0, "you should never look at the bits of a ZST"); - assert_eq!(target_size.bytes(), u64::from(self.size)); - self.check_data(); - self.data + self.to_bits(target_size).unwrap_or_else(|size| { + bug!("int of size {}, but is {}", target_size.bytes(), size.bytes()) + }) } #[inline]