1
Fork 0

Do not ICE on constant evaluation failure in GVN.

This commit is contained in:
Camille GILLOT 2023-10-31 10:31:10 +00:00
parent 31bc7e2c47
commit 5b7cc9d704
4 changed files with 30 additions and 5 deletions

View file

@ -520,11 +520,13 @@ impl<'tcx> Const<'tcx> {
// types are fine though.
ty::ConstKind::Value(_) => c.ty().is_primitive(),
ty::ConstKind::Unevaluated(..) | ty::ConstKind::Expr(..) => false,
// This can happen if evaluation of a constant failed. The result does not matter
// much since compilation is doomed.
ty::ConstKind::Error(..) => false,
// Should not appear in runtime MIR.
ty::ConstKind::Infer(..)
| ty::ConstKind::Bound(..)
| ty::ConstKind::Placeholder(..)
| ty::ConstKind::Error(..) => bug!(),
| ty::ConstKind::Placeholder(..) => bug!(),
},
Const::Unevaluated(..) => false,
// If the same slice appears twice in the MIR, we cannot guarantee that we will