1
Fork 0

Move ConstEvaluatable to Clause

This commit is contained in:
Michael Goulet 2023-06-15 18:35:52 +00:00
parent 52d3fc93f2
commit 6594c75449
30 changed files with 54 additions and 55 deletions

View file

@ -1529,14 +1529,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
} }
ty::Clause::RegionOutlives(_) ty::Clause::RegionOutlives(_)
| ty::Clause::ConstArgHasType(..) | ty::Clause::ConstArgHasType(..)
| ty::Clause::WellFormed(_) => bug!(), | ty::Clause::WellFormed(_)
| ty::Clause::ConstEvaluatable(_) => bug!(),
}, },
ty::PredicateKind::AliasRelate(..) ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::ObjectSafe(_) | ty::PredicateKind::ObjectSafe(_)
| ty::PredicateKind::ClosureKind(_, _, _) | ty::PredicateKind::ClosureKind(_, _, _)
| ty::PredicateKind::Subtype(_) | ty::PredicateKind::Subtype(_)
| ty::PredicateKind::Coerce(_) | ty::PredicateKind::Coerce(_)
| ty::PredicateKind::ConstEvaluatable(_)
| ty::PredicateKind::ConstEquate(_, _) | ty::PredicateKind::ConstEquate(_, _)
| ty::PredicateKind::TypeWellFormedFromEnv(_) | ty::PredicateKind::TypeWellFormedFromEnv(_)
| ty::PredicateKind::Ambiguous => bug!(), | ty::PredicateKind::Ambiguous => bug!(),

View file

@ -1032,9 +1032,9 @@ fn check_type_defn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'tcx>, all_sized: b
tcx, tcx,
cause, cause,
wfcx.param_env, wfcx.param_env,
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable( ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(
ty::Const::from_anon_const(tcx, discr_def_id.expect_local()), ty::Const::from_anon_const(tcx, discr_def_id.expect_local()),
)), ))),
)); ));
} }
} }

View file

@ -353,7 +353,7 @@ fn const_evaluatable_predicates_of(
if let ty::ConstKind::Unevaluated(_) = ct.kind() { if let ty::ConstKind::Unevaluated(_) = ct.kind() {
let span = self.tcx.def_span(c.def_id); let span = self.tcx.def_span(c.def_id);
self.preds.insert(( self.preds.insert((
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct)) ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(ct)))
.to_predicate(self.tcx), .to_predicate(self.tcx),
span, span,
)); ));

View file

@ -547,7 +547,7 @@ fn trait_predicate_kind<'tcx>(
| ty::PredicateKind::Coerce(_) | ty::PredicateKind::Coerce(_)
| ty::PredicateKind::ObjectSafe(_) | ty::PredicateKind::ObjectSafe(_)
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None, | ty::PredicateKind::TypeWellFormedFromEnv(..) => None,

View file

@ -61,7 +61,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..) | ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => (), | ty::PredicateKind::TypeWellFormedFromEnv(..) => (),

View file

@ -671,7 +671,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
| ty::PredicateKind::Clause(ty::Clause::WellFormed(..)) | ty::PredicateKind::Clause(ty::Clause::WellFormed(..))
| ty::PredicateKind::ObjectSafe(..) | ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
// N.B., this predicate is created by breaking down a // N.B., this predicate is created by breaking down a
// `ClosureType: FnFoo()` predicate, where // `ClosureType: FnFoo()` predicate, where

View file

@ -32,7 +32,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(arg, ty)) => { ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(arg, ty)) => {
vec![ty.into(), arg.into()] vec![ty.into(), arg.into()]
} }
ty::PredicateKind::ConstEvaluatable(e) => vec![e.into()], ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(e)) => vec![e.into()],
_ => return false, _ => return false,
}; };

View file

@ -842,7 +842,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
| ty::PredicateKind::ObjectSafe(..) | ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..)) | ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..))
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..)

View file

@ -33,7 +33,7 @@ pub fn explicit_outlives_bounds<'tcx>(
| ty::PredicateKind::ObjectSafe(..) | ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..)) | ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..))
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None, | ty::PredicateKind::TypeWellFormedFromEnv(..) => None,

View file

@ -249,7 +249,7 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
ty::PredicateKind::ClosureKind(..) => { ty::PredicateKind::ClosureKind(..) => {
// Nothing to elaborate when waiting for a closure's kind to be inferred. // Nothing to elaborate when waiting for a closure's kind to be inferred.
} }
ty::PredicateKind::ConstEvaluatable(..) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..)) => {
// Currently, we do not elaborate const-evaluatable // Currently, we do not elaborate const-evaluatable
// predicates. // predicates.
} }

View file

@ -1611,12 +1611,12 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
AliasRelate(..) | AliasRelate(..) |
// Ignore bounds that a user can't type // Ignore bounds that a user can't type
Clause(Clause::WellFormed(..)) | Clause(Clause::WellFormed(..)) |
// FIXME(generic_const_exprs): `ConstEvaluatable` can be written
Clause(Clause::ConstEvaluatable(..)) |
ObjectSafe(..) | ObjectSafe(..) |
ClosureKind(..) | ClosureKind(..) |
Subtype(..) | Subtype(..) |
Coerce(..) | Coerce(..) |
// FIXME(generic_const_exprs): `ConstEvaluatable` can be written
ConstEvaluatable(..) |
ConstEquate(..) | ConstEquate(..) |
Ambiguous | Ambiguous |
TypeWellFormedFromEnv(..) => continue, TypeWellFormedFromEnv(..) => continue,

View file

@ -277,7 +277,7 @@ impl FlagComputation {
ty::PredicateKind::ClosureKind(_def_id, substs, _kind) => { ty::PredicateKind::ClosureKind(_def_id, substs, _kind) => {
self.add_substs(substs); self.add_substs(substs);
} }
ty::PredicateKind::ConstEvaluatable(uv) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(uv)) => {
self.add_const(uv); self.add_const(uv);
} }
ty::PredicateKind::ConstEquate(expected, found) => { ty::PredicateKind::ConstEquate(expected, found) => {

View file

@ -547,7 +547,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::ClosureKind(_, _, _) | PredicateKind::ClosureKind(_, _, _)
| PredicateKind::Subtype(_) | PredicateKind::Subtype(_)
| PredicateKind::Coerce(_) | PredicateKind::Coerce(_)
| PredicateKind::ConstEvaluatable(_) | PredicateKind::Clause(Clause::ConstEvaluatable(_))
| PredicateKind::ConstEquate(_, _) | PredicateKind::ConstEquate(_, _)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous
| PredicateKind::TypeWellFormedFromEnv(_) => true, | PredicateKind::TypeWellFormedFromEnv(_) => true,
@ -587,6 +587,9 @@ pub enum Clause<'tcx> {
/// No syntax: `T` well-formed. /// No syntax: `T` well-formed.
WellFormed(GenericArg<'tcx>), WellFormed(GenericArg<'tcx>),
/// Constant initializer must evaluate successfully.
ConstEvaluatable(ty::Const<'tcx>),
} }
impl<'tcx> Binder<'tcx, Clause<'tcx>> { impl<'tcx> Binder<'tcx, Clause<'tcx>> {
@ -638,9 +641,6 @@ pub enum PredicateKind<'tcx> {
/// logic. /// logic.
Coerce(CoercePredicate<'tcx>), Coerce(CoercePredicate<'tcx>),
/// Constant initializer must evaluate successfully.
ConstEvaluatable(ty::Const<'tcx>),
/// Constants must be equal. The first component is the const that is expected. /// Constants must be equal. The first component is the const that is expected.
ConstEquate(Const<'tcx>, Const<'tcx>), ConstEquate(Const<'tcx>, Const<'tcx>),
@ -1328,7 +1328,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::ObjectSafe(..) | PredicateKind::ObjectSafe(..)
| PredicateKind::ClosureKind(..) | PredicateKind::ClosureKind(..)
| PredicateKind::Clause(Clause::TypeOutlives(..)) | PredicateKind::Clause(Clause::TypeOutlives(..))
| PredicateKind::ConstEvaluatable(..) | PredicateKind::Clause(Clause::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..) | PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous
| PredicateKind::TypeWellFormedFromEnv(..) => None, | PredicateKind::TypeWellFormedFromEnv(..) => None,
@ -1349,7 +1349,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::ObjectSafe(..) | PredicateKind::ObjectSafe(..)
| PredicateKind::ClosureKind(..) | PredicateKind::ClosureKind(..)
| PredicateKind::Clause(Clause::TypeOutlives(..)) | PredicateKind::Clause(Clause::TypeOutlives(..))
| PredicateKind::ConstEvaluatable(..) | PredicateKind::Clause(Clause::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..) | PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous
| PredicateKind::TypeWellFormedFromEnv(..) => None, | PredicateKind::TypeWellFormedFromEnv(..) => None,
@ -1370,7 +1370,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Clause(Clause::WellFormed(..)) | PredicateKind::Clause(Clause::WellFormed(..))
| PredicateKind::ObjectSafe(..) | PredicateKind::ObjectSafe(..)
| PredicateKind::ClosureKind(..) | PredicateKind::ClosureKind(..)
| PredicateKind::ConstEvaluatable(..) | PredicateKind::Clause(Clause::ConstEvaluatable(..))
| PredicateKind::ConstEquate(..) | PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous
| PredicateKind::TypeWellFormedFromEnv(..) => None, | PredicateKind::TypeWellFormedFromEnv(..) => None,
@ -1384,10 +1384,8 @@ impl<'tcx> Predicate<'tcx> {
PredicateKind::AliasRelate(..) PredicateKind::AliasRelate(..)
| PredicateKind::Subtype(..) | PredicateKind::Subtype(..)
| PredicateKind::Coerce(..) | PredicateKind::Coerce(..)
| PredicateKind::WellFormed(..)
| PredicateKind::ObjectSafe(..) | PredicateKind::ObjectSafe(..)
| PredicateKind::ClosureKind(..) | PredicateKind::ClosureKind(..)
| PredicateKind::ConstEvaluatable(..)
| PredicateKind::ConstEquate(..) | PredicateKind::ConstEquate(..)
| PredicateKind::Ambiguous | PredicateKind::Ambiguous
| PredicateKind::TypeWellFormedFromEnv(..) => None, | PredicateKind::TypeWellFormedFromEnv(..) => None,

View file

@ -2886,7 +2886,7 @@ define_print_and_forward_display! {
print_value_path(closure_def_id, &[]), print_value_path(closure_def_id, &[]),
write("` implements the trait `{}`", kind) write("` implements the trait `{}`", kind)
), ),
ty::PredicateKind::ConstEvaluatable(ct) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(ct)) => {
p!("the constant `", print(ct), "` can be evaluated") p!("the constant `", print(ct), "` can be evaluated")
} }
ty::PredicateKind::ConstEquate(c1, c2) => { ty::PredicateKind::ConstEquate(c1, c2) => {

View file

@ -180,6 +180,9 @@ impl<'tcx> fmt::Debug for ty::Clause<'tcx> {
ty::Clause::TypeOutlives(ref pair) => pair.fmt(f), ty::Clause::TypeOutlives(ref pair) => pair.fmt(f),
ty::Clause::Projection(ref pair) => pair.fmt(f), ty::Clause::Projection(ref pair) => pair.fmt(f),
ty::Clause::WellFormed(ref data) => write!(f, "WellFormed({:?})", data), ty::Clause::WellFormed(ref data) => write!(f, "WellFormed({:?})", data),
ty::Clause::ConstEvaluatable(ct) => {
write!(f, "ConstEvaluatable({ct:?})")
}
} }
} }
} }
@ -196,9 +199,6 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) => { ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) => {
write!(f, "ClosureKind({:?}, {:?}, {:?})", closure_def_id, closure_substs, kind) write!(f, "ClosureKind({:?}, {:?}, {:?})", closure_def_id, closure_substs, kind)
} }
ty::PredicateKind::ConstEvaluatable(ct) => {
write!(f, "ConstEvaluatable({ct:?})")
}
ty::PredicateKind::ConstEquate(c1, c2) => write!(f, "ConstEquate({:?}, {:?})", c1, c2), ty::PredicateKind::ConstEquate(c1, c2) => write!(f, "ConstEquate({:?}, {:?})", c1, c2),
ty::PredicateKind::TypeWellFormedFromEnv(ty) => { ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
write!(f, "TypeWellFormedFromEnv({:?})", ty) write!(f, "TypeWellFormedFromEnv({:?})", ty)

View file

@ -182,7 +182,7 @@ where
ct.visit_with(self)?; ct.visit_with(self)?;
ty.visit_with(self) ty.visit_with(self)
} }
ty::PredicateKind::ConstEvaluatable(ct) => ct.visit_with(self), ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(ct)) => ct.visit_with(self),
ty::PredicateKind::Clause(ty::Clause::WellFormed(arg)) => arg.visit_with(self), ty::PredicateKind::Clause(ty::Clause::WellFormed(arg)) => arg.visit_with(self),
ty::PredicateKind::ObjectSafe(_) ty::PredicateKind::ObjectSafe(_)

View file

@ -326,7 +326,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS) self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
} }
// FIXME: implement this predicate :) // FIXME: implement this predicate :)
ty::PredicateKind::ConstEvaluatable(_) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(_)) => {
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
} }
ty::PredicateKind::ConstEquate(_, _) => { ty::PredicateKind::ConstEquate(_, _) => {

View file

@ -121,7 +121,6 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
ty::PredicateKind::Clause(_) ty::PredicateKind::Clause(_)
| ty::PredicateKind::ObjectSafe(_) | ty::PredicateKind::ObjectSafe(_)
| ty::PredicateKind::ClosureKind(_, _, _) | ty::PredicateKind::ClosureKind(_, _, _)
| ty::PredicateKind::ConstEvaluatable(_)
| ty::PredicateKind::Ambiguous => { | ty::PredicateKind::Ambiguous => {
FulfillmentErrorCode::CodeSelectionError( FulfillmentErrorCode::CodeSelectionError(
SelectionError::Unimplemented, SelectionError::Unimplemented,

View file

@ -833,7 +833,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..) | ty::PredicateKind::Subtype(..)
// FIXME(generic_const_exprs): you can absolutely add this as a where clauses // FIXME(generic_const_exprs): you can absolutely add this as a where clauses
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::Coerce(..) => {} | ty::PredicateKind::Coerce(..) => {}
ty::PredicateKind::TypeWellFormedFromEnv(..) => { ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("predicate should only exist in the environment: {bound_predicate:?}") bug!("predicate should only exist in the environment: {bound_predicate:?}")

View file

@ -207,7 +207,7 @@ fn satisfied_from_param_env<'tcx>(
for pred in param_env.caller_bounds() { for pred in param_env.caller_bounds() {
match pred.kind().skip_binder() { match pred.kind().skip_binder() {
ty::PredicateKind::ConstEvaluatable(ce) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(ce)) => {
let b_ct = tcx.expand_abstract_consts(ce); let b_ct = tcx.expand_abstract_consts(ce);
let mut v = Visitor { ct, infcx, param_env, single_match }; let mut v = Visitor { ct, infcx, param_env, single_match };
let _ = b_ct.visit_with(&mut v); let _ = b_ct.visit_with(&mut v);

View file

@ -1069,7 +1069,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
} }
} }
ty::PredicateKind::ConstEvaluatable(..) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..)) => {
// Errors for `ConstEvaluatable` predicates show up as // Errors for `ConstEvaluatable` predicates show up as
// `SelectionError::ConstEvalFailure`, // `SelectionError::ConstEvalFailure`,
// not `Unimplemented`. // not `Unimplemented`.
@ -2487,7 +2487,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
} }
} }
ty::PredicateKind::ConstEvaluatable(data) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(data)) => {
if predicate.references_error() || self.tainted_by_errors().is_some() { if predicate.references_error() || self.tainted_by_errors().is_some() {
return; return;
} }
@ -3325,7 +3325,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
} }
match obligation.predicate.kind().skip_binder() { match obligation.predicate.kind().skip_binder() {
ty::PredicateKind::ConstEvaluatable(ct) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(ct)) => {
let ty::ConstKind::Unevaluated(uv) = ct.kind() else { let ty::ConstKind::Unevaluated(uv) = ct.kind() else {
bug!("const evaluatable failed for non-unevaluated const `{ct:?}`"); bug!("const evaluatable failed for non-unevaluated const `{ct:?}`");
}; };

View file

@ -359,7 +359,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(_) | ty::PredicateKind::Subtype(_)
| ty::PredicateKind::Coerce(_) | ty::PredicateKind::Coerce(_)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) => { | ty::PredicateKind::ConstEquate(..) => {
let pred = let pred =
ty::Binder::dummy(infcx.instantiate_binder_with_placeholders(binder)); ty::Binder::dummy(infcx.instantiate_binder_with_placeholders(binder));
@ -498,7 +498,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
} }
} }
ty::PredicateKind::ConstEvaluatable(uv) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(uv)) => {
match const_evaluatable::is_const_evaluatable( match const_evaluatable::is_const_evaluatable(
self.selcx.infcx, self.selcx.infcx,
uv, uv,

View file

@ -318,7 +318,7 @@ fn predicate_references_self<'tcx>(
| ty::PredicateKind::Subtype(..) | ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
// FIXME(generic_const_exprs): this can mention `Self` // FIXME(generic_const_exprs): this can mention `Self`
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None, | ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
@ -365,7 +365,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
| ty::PredicateKind::ObjectSafe(..) | ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..)) | ty::PredicateKind::Clause(ty::Clause::TypeOutlives(..))
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous

View file

@ -130,7 +130,7 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
| ty::PredicateKind::Clause(ty::Clause::Projection(..)) | ty::PredicateKind::Clause(ty::Clause::Projection(..))
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::ObjectSafe(..) | ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..)

View file

@ -862,7 +862,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} }
} }
ty::PredicateKind::ConstEvaluatable(uv) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(uv)) => {
match const_evaluatable::is_const_evaluatable( match const_evaluatable::is_const_evaluatable(
self.infcx, self.infcx,
uv, uv,

View file

@ -164,7 +164,7 @@ pub fn predicate_obligations<'tcx>(
wf.compute(arg); wf.compute(arg);
} }
ty::PredicateKind::ConstEvaluatable(ct) => { ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(ct)) => {
wf.compute(ct.into()); wf.compute(ct.into());
} }
@ -521,8 +521,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
let obligations = self.nominal_obligations(uv.def, uv.substs); let obligations = self.nominal_obligations(uv.def, uv.substs);
self.out.extend(obligations); self.out.extend(obligations);
let predicate = let predicate = ty::Binder::dummy(ty::PredicateKind::Clause(
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct)); ty::Clause::ConstEvaluatable(ct),
));
let cause = self.cause(traits::WellFormed(None)); let cause = self.cause(traits::WellFormed(None));
self.out.push(traits::Obligation::with_depth( self.out.push(traits::Obligation::with_depth(
self.tcx(), self.tcx(),
@ -554,8 +555,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
// the future we may allow directly lowering to `ConstKind::Expr` in which case // the future we may allow directly lowering to `ConstKind::Expr` in which case
// we would not be proving bounds we should. // we would not be proving bounds we should.
let predicate = let predicate = ty::Binder::dummy(ty::PredicateKind::Clause(
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct)); ty::Clause::ConstEvaluatable(ct),
));
let cause = self.cause(traits::WellFormed(None)); let cause = self.cause(traits::WellFormed(None));
self.out.push(traits::Obligation::with_depth( self.out.push(traits::Obligation::with_depth(
self.tcx(), self.tcx(),
@ -977,7 +979,7 @@ pub(crate) fn required_region_bounds<'tcx>(
| ty::PredicateKind::ObjectSafe(..) | ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Clause(ty::Clause::RegionOutlives(..)) | ty::PredicateKind::Clause(ty::Clause::RegionOutlives(..))
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..)

View file

@ -137,7 +137,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::InEnvironment<chalk_ir::Goal<RustInterner<'
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..) | ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::ConstEquate(..) => bug!("unexpected predicate {}", predicate), | ty::PredicateKind::ConstEquate(..) => bug!("unexpected predicate {}", predicate),
}; };
@ -231,7 +231,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData<RustInterner<'tcx>>> for ty::Predi
| ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(..)) | ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(..))
| ty::PredicateKind::AliasRelate(..) | ty::PredicateKind::AliasRelate(..)
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::ConstEquate(..) => { | ty::PredicateKind::ConstEquate(..) => {
chalk_ir::GoalData::All(chalk_ir::Goals::empty(interner)) chalk_ir::GoalData::All(chalk_ir::Goals::empty(interner))
@ -680,7 +680,7 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_ir::QuantifiedWhereClause<RustInterner<'
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..) | ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => { | ty::PredicateKind::TypeWellFormedFromEnv(..) => {
@ -816,7 +816,7 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_solve::rust_ir::QuantifiedInlineBound<Ru
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..) | ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => { | ty::PredicateKind::TypeWellFormedFromEnv(..) => {

View file

@ -67,7 +67,7 @@ fn not_outlives_predicate(p: ty::Predicate<'_>) -> bool {
| ty::PredicateKind::ClosureKind(..) | ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..) | ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..) | ty::PredicateKind::Coerce(..)
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => true, | ty::PredicateKind::TypeWellFormedFromEnv(..) => true,

View file

@ -344,7 +344,7 @@ pub(crate) fn clean_predicate<'tcx>(
Some(clean_projection_predicate(bound_predicate.rebind(pred), cx)) Some(clean_projection_predicate(bound_predicate.rebind(pred), cx))
} }
// FIXME(generic_const_exprs): should this do something? // FIXME(generic_const_exprs): should this do something?
ty::PredicateKind::ConstEvaluatable(..) => None, ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..)) => None,
ty::PredicateKind::Clause(ty::Clause::WellFormed(..)) => None, ty::PredicateKind::Clause(ty::Clause::WellFormed(..)) => None,
ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(..)) => None, ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(..)) => None,

View file

@ -34,7 +34,7 @@ pub fn is_min_const_fn<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, msrv: &Msrv)
| ty::Clause::ConstArgHasType(..), | ty::Clause::ConstArgHasType(..),
) )
| ty::PredicateKind::Clause(ty::Clause::WellFormed(_)) | ty::PredicateKind::Clause(ty::Clause::WellFormed(_))
| ty::PredicateKind::ConstEvaluatable(..) | ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..) | ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => continue, | ty::PredicateKind::TypeWellFormedFromEnv(..) => continue,
ty::PredicateKind::AliasRelate(..) => panic!("alias relate predicate on function: {predicate:#?}"), ty::PredicateKind::AliasRelate(..) => panic!("alias relate predicate on function: {predicate:#?}"),