1
Fork 0

ScalarInt: add methods to assert being a (u)int of given size

This commit is contained in:
Ralf Jung 2024-04-18 08:38:37 +02:00
parent 5e6184cdb7
commit 42220f0930
13 changed files with 78 additions and 72 deletions

View file

@ -796,7 +796,7 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
if let Some(ref value) = self.eval_operand(discr)
&& let Some(value_const) = self.use_ecx(|this| this.ecx.read_scalar(value))
&& let Ok(constant) = value_const.try_to_int()
&& let Ok(constant) = constant.to_bits(constant.size())
&& let Ok(constant) = constant.try_to_bits(constant.size())
{
// We managed to evaluate the discriminant, so we know we only need to visit
// one target.