fix #104390, fix ICE in in_operand for ty error

This commit is contained in:
yukang 2022-11-15 13:20:55 +08:00
parent bebd57a960
commit 20ea083d87
3 changed files with 80 additions and 1 deletions

View file

@ -351,7 +351,11 @@ where
// FIXME(valtrees): check whether const qualifs should behave the same
// way for type and mir constants.
let uneval = match constant.literal {
ConstantKind::Ty(ct) if matches!(ct.kind(), ty::ConstKind::Param(_)) => None,
ConstantKind::Ty(ct)
if matches!(ct.kind(), ty::ConstKind::Param(_) | ty::ConstKind::Error(_)) =>
{
None
}
ConstantKind::Ty(c) => bug!("expected ConstKind::Param here, found {:?}", c),
ConstantKind::Unevaluated(uv, _) => Some(uv),
ConstantKind::Val(..) => None,