Rollup merge of #112667 - compiler-errors:wf-goal-is-clause, r=lcnr
Move WF/ConstEvaluatable goal to clause It can show up in a param-env, so I think it needs to be a clause kind. r? ```@lcnr``` or ```@oli-obk```
This commit is contained in:
commit
8d3d3cc0ba
40 changed files with 719 additions and 685 deletions
|
@ -270,14 +270,14 @@ impl FlagComputation {
|
|||
self.add_alias_ty(projection_ty);
|
||||
self.add_term(term);
|
||||
}
|
||||
ty::PredicateKind::WellFormed(arg) => {
|
||||
ty::PredicateKind::Clause(ty::Clause::WellFormed(arg)) => {
|
||||
self.add_substs(slice::from_ref(&arg));
|
||||
}
|
||||
ty::PredicateKind::ObjectSafe(_def_id) => {}
|
||||
ty::PredicateKind::ClosureKind(_def_id, substs, _kind) => {
|
||||
self.add_substs(substs);
|
||||
}
|
||||
ty::PredicateKind::ConstEvaluatable(uv) => {
|
||||
ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(uv)) => {
|
||||
self.add_const(uv);
|
||||
}
|
||||
ty::PredicateKind::ConstEquate(expected, found) => {
|
||||
|
|
|
@ -523,7 +523,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
ty::PredicateKind::Clause(ty::Clause::Trait(data)) => {
|
||||
tcx.trait_is_coinductive(data.def_id())
|
||||
}
|
||||
ty::PredicateKind::WellFormed(_) => true,
|
||||
ty::PredicateKind::Clause(ty::Clause::WellFormed(_)) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
#[inline]
|
||||
pub fn allow_normalization(self) -> bool {
|
||||
match self.kind().skip_binder() {
|
||||
PredicateKind::WellFormed(_) => false,
|
||||
PredicateKind::Clause(Clause::WellFormed(_)) => false,
|
||||
PredicateKind::Clause(Clause::Trait(_))
|
||||
| PredicateKind::Clause(Clause::RegionOutlives(_))
|
||||
| PredicateKind::Clause(Clause::TypeOutlives(_))
|
||||
|
@ -547,7 +547,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::ClosureKind(_, _, _)
|
||||
| PredicateKind::Subtype(_)
|
||||
| PredicateKind::Coerce(_)
|
||||
| PredicateKind::ConstEvaluatable(_)
|
||||
| PredicateKind::Clause(Clause::ConstEvaluatable(_))
|
||||
| PredicateKind::ConstEquate(_, _)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(_) => true,
|
||||
|
@ -584,6 +584,12 @@ pub enum Clause<'tcx> {
|
|||
/// Ensures that a const generic argument to a parameter `const N: u8`
|
||||
/// is of type `u8`.
|
||||
ConstArgHasType(Const<'tcx>, Ty<'tcx>),
|
||||
|
||||
/// No syntax: `T` well-formed.
|
||||
WellFormed(GenericArg<'tcx>),
|
||||
|
||||
/// Constant initializer must evaluate successfully.
|
||||
ConstEvaluatable(ty::Const<'tcx>),
|
||||
}
|
||||
|
||||
impl<'tcx> Binder<'tcx, Clause<'tcx>> {
|
||||
|
@ -610,9 +616,6 @@ pub enum PredicateKind<'tcx> {
|
|||
/// Prove a clause
|
||||
Clause(Clause<'tcx>),
|
||||
|
||||
/// No syntax: `T` well-formed.
|
||||
WellFormed(GenericArg<'tcx>),
|
||||
|
||||
/// Trait must be object-safe.
|
||||
ObjectSafe(DefId),
|
||||
|
||||
|
@ -638,9 +641,6 @@ pub enum PredicateKind<'tcx> {
|
|||
/// logic.
|
||||
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.
|
||||
ConstEquate(Const<'tcx>, Const<'tcx>),
|
||||
|
||||
|
@ -1324,11 +1324,11 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::Subtype(..)
|
||||
| PredicateKind::Coerce(..)
|
||||
| PredicateKind::Clause(Clause::RegionOutlives(..))
|
||||
| PredicateKind::WellFormed(..)
|
||||
| PredicateKind::Clause(Clause::WellFormed(..))
|
||||
| PredicateKind::ObjectSafe(..)
|
||||
| PredicateKind::ClosureKind(..)
|
||||
| PredicateKind::Clause(Clause::TypeOutlives(..))
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::Clause(Clause::ConstEvaluatable(..))
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
|
@ -1345,11 +1345,11 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::Subtype(..)
|
||||
| PredicateKind::Coerce(..)
|
||||
| PredicateKind::Clause(Clause::RegionOutlives(..))
|
||||
| PredicateKind::WellFormed(..)
|
||||
| PredicateKind::Clause(Clause::WellFormed(..))
|
||||
| PredicateKind::ObjectSafe(..)
|
||||
| PredicateKind::ClosureKind(..)
|
||||
| PredicateKind::Clause(Clause::TypeOutlives(..))
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::Clause(Clause::ConstEvaluatable(..))
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
|
@ -1367,10 +1367,10 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::Subtype(..)
|
||||
| PredicateKind::Coerce(..)
|
||||
| PredicateKind::Clause(Clause::RegionOutlives(..))
|
||||
| PredicateKind::WellFormed(..)
|
||||
| PredicateKind::Clause(Clause::WellFormed(..))
|
||||
| PredicateKind::ObjectSafe(..)
|
||||
| PredicateKind::ClosureKind(..)
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::Clause(Clause::ConstEvaluatable(..))
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
|
@ -1384,10 +1384,8 @@ impl<'tcx> Predicate<'tcx> {
|
|||
PredicateKind::AliasRelate(..)
|
||||
| PredicateKind::Subtype(..)
|
||||
| PredicateKind::Coerce(..)
|
||||
| PredicateKind::WellFormed(..)
|
||||
| PredicateKind::ObjectSafe(..)
|
||||
| PredicateKind::ClosureKind(..)
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
|
|
|
@ -2877,7 +2877,7 @@ define_print_and_forward_display! {
|
|||
ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(ct, ty)) => {
|
||||
p!("the constant `", print(ct), "` has type `", print(ty), "`")
|
||||
},
|
||||
ty::PredicateKind::WellFormed(arg) => p!(print(arg), " well-formed"),
|
||||
ty::PredicateKind::Clause(ty::Clause::WellFormed(arg)) => p!(print(arg), " well-formed"),
|
||||
ty::PredicateKind::ObjectSafe(trait_def_id) => {
|
||||
p!("the trait `", print_def_path(trait_def_id, &[]), "` is object-safe")
|
||||
}
|
||||
|
@ -2886,7 +2886,7 @@ define_print_and_forward_display! {
|
|||
print_value_path(closure_def_id, &[]),
|
||||
write("` implements the trait `{}`", kind)
|
||||
),
|
||||
ty::PredicateKind::ConstEvaluatable(ct) => {
|
||||
ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(ct)) => {
|
||||
p!("the constant `", print(ct), "` can be evaluated")
|
||||
}
|
||||
ty::PredicateKind::ConstEquate(c1, c2) => {
|
||||
|
|
|
@ -179,6 +179,10 @@ impl<'tcx> fmt::Debug for ty::Clause<'tcx> {
|
|||
ty::Clause::RegionOutlives(ref pair) => pair.fmt(f),
|
||||
ty::Clause::TypeOutlives(ref pair) => pair.fmt(f),
|
||||
ty::Clause::Projection(ref pair) => pair.fmt(f),
|
||||
ty::Clause::WellFormed(ref data) => write!(f, "WellFormed({:?})", data),
|
||||
ty::Clause::ConstEvaluatable(ct) => {
|
||||
write!(f, "ConstEvaluatable({ct:?})")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,16 +193,12 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
|
|||
ty::PredicateKind::Clause(ref a) => a.fmt(f),
|
||||
ty::PredicateKind::Subtype(ref pair) => pair.fmt(f),
|
||||
ty::PredicateKind::Coerce(ref pair) => pair.fmt(f),
|
||||
ty::PredicateKind::WellFormed(data) => write!(f, "WellFormed({:?})", data),
|
||||
ty::PredicateKind::ObjectSafe(trait_def_id) => {
|
||||
write!(f, "ObjectSafe({:?})", trait_def_id)
|
||||
}
|
||||
ty::PredicateKind::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::TypeWellFormedFromEnv(ty) => {
|
||||
write!(f, "TypeWellFormedFromEnv({:?})", ty)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue