1
Fork 0

get rid of visit_constant in thir visitor

This commit is contained in:
b-naber 2022-04-06 10:12:42 +02:00
parent 14e3d038c0
commit c3491378e3
5 changed files with 27 additions and 24 deletions

View file

@ -183,12 +183,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
Some((*lo, *hi))
}
(Some(PatKind::Constant { value: lo }), None) => {
let hi = ty.numeric_max_val(self.tcx)?;
Some((*lo, ty::Const::from_bits(self.tcx, hi, ty::ParamEnv::empty().and(ty))))
Some((*lo, ty.numeric_max_val(self.tcx)?))
}
(None, Some(PatKind::Constant { value: hi })) => {
let lo = ty.numeric_min_val(self.tcx)?;
Some((ty::Const::from_bits(self.tcx, lo, ty::ParamEnv::empty().and(ty)), *hi))
Some((ty.numeric_min_val(self.tcx)?, *hi))
}
_ => None,
}