X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_const_eval%2Fsrc%2Ftransform%2Fcheck_consts%2Fqualifs.rs;h=6fd12985170e637e31b578cef69f90ece55336ca;hb=ed97f245f1a15f0ba22a622fb693ac8bdbdbed0c;hp=d995d533ca3e434ff9da5b25aba08375bfd50c61;hpb=1d262cd71317709000c63d8e7e899b46f9aa33a5;p=rust.git diff --git a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs index d995d533ca3..6fd12985170 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs @@ -156,6 +156,7 @@ fn in_any_value_of_ty<'tcx>(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool { let destruct = cx.tcx.require_lang_item(LangItem::Destruct, None); let obligation = Obligation::new( + cx.tcx, ObligationCause::dummy(), cx.param_env, ty::Binder::dummy(ty::TraitPredicate { @@ -351,7 +352,11 @@ pub fn in_operand<'tcx, Q, F>( // 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,