Int constants must be valtrees in pattern lowering

This commit is contained in:
Oli Scherer 2024-03-27 14:28:50 +00:00
parent d03df0a6b3
commit bd6a96f04e

View File

@ -1018,11 +1018,7 @@ impl<'tcx> PatRangeBoundary<'tcx> {
(Finite(mir::Const::Ty(a)), Finite(mir::Const::Ty(b)))
if matches!(ty.kind(), ty::Uint(_) | ty::Char) =>
{
if let Some(a) = a.try_to_valtree() {
if let Some(b) = b.try_to_valtree() {
return Some(a.cmp(&b));
}
}
return Some(a.to_valtree().cmp(&b.to_valtree()));
}
(
Finite(mir::Const::Val(mir::ConstValue::Scalar(Scalar::Int(a)), _)),