We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
assert_bits
1 parent dad0036 commit 98b70c9Copy full SHA for 98b70c9
compiler/rustc_middle/src/ty/consts/int.rs
@@ -225,10 +225,9 @@ impl ScalarInt {
225
226
#[inline]
227
pub fn assert_bits(self, target_size: Size) -> u128 {
228
- assert_ne!(target_size.bytes(), 0, "you should never look at the bits of a ZST");
229
- assert_eq!(target_size.bytes(), u64::from(self.size));
230
- self.check_data();
231
- self.data
+ self.to_bits(target_size).unwrap_or_else(|size| {
+ bug!("int of size {}, but is {}", target_size.bytes(), size.bytes())
+ })
232
}
233
234
0 commit comments