Rollup merge of #102466 - lcnr:const-equate-uwu, r=BoxyUwU

only allow `ConstEquate` with `feature(gce)`
This commit is contained in:
Matthias Krüger 2022-10-17 17:15:50 +02:00 committed by GitHub
commit e91fd0b514
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 23 deletions

View file

@ -676,19 +676,21 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
ty::PredicateKind::ConstEquate(c1, c2) => {
assert!(
self.tcx().features().generic_const_exprs,
"`ConstEquate` without a feature gate: {c1:?} {c2:?}",
);
debug!(?c1, ?c2, "evaluate_predicate_recursively: equating consts");
if self.tcx().features().generic_const_exprs {
// FIXME: we probably should only try to unify abstract constants
// if the constants depend on generic parameters.
//
// Let's just see where this breaks :shrug:
if let (ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b)) =
(c1.kind(), c2.kind())
{
if self.infcx.try_unify_abstract_consts(a, b, obligation.param_env) {
return Ok(EvaluatedToOk);
}
// FIXME: we probably should only try to unify abstract constants
// if the constants depend on generic parameters.
//
// Let's just see where this breaks :shrug:
if let (ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b)) =
(c1.kind(), c2.kind())
{
if self.infcx.try_unify_abstract_consts(a, b, obligation.param_env) {
return Ok(EvaluatedToOk);
}
}