use bug! for overflow of u128

This commit is contained in:
yukang 2023-06-11 17:03:26 +08:00
parent b133841bfc
commit 3bbc598d16

View file

@ -87,7 +87,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Some(v) = u128::from(size.bytes()).checked_mul(8) {
format!("{} bits", v)
} else {
format!("{} bytes", size.bytes())
// `u128` should definitely be able to hold the size of different architectures
// larger sizes should be reported as error `are too big for the current architecture`
// otherwise we have a bug somewhere
bug!("{:?} overflow for u128", size)
}
}
Ok(SizeSkeleton::Generic(size)) => {