TypeWellFormedInEnv
This commit is contained in:
parent
fbdef58414
commit
374173cd99
26 changed files with 75 additions and 74 deletions
|
@ -287,7 +287,7 @@ impl FlagComputation {
|
|||
self.add_const(expected);
|
||||
self.add_const(found);
|
||||
}
|
||||
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(ty)) => {
|
||||
self.add_ty(ty);
|
||||
}
|
||||
ty::PredicateKind::Ambiguous => {}
|
||||
|
|
|
@ -555,7 +555,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
|
||||
| PredicateKind::ConstEquate(_, _)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(_) => true,
|
||||
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(_)) => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -661,6 +661,11 @@ pub enum ClauseKind<'tcx> {
|
|||
|
||||
/// Constant initializer must evaluate successfully.
|
||||
ConstEvaluatable(ty::Const<'tcx>),
|
||||
|
||||
/// Represents a type found in the environment that we can use for implied bounds.
|
||||
///
|
||||
/// Only used for Chalk.
|
||||
TypeWellFormedFromEnv(Ty<'tcx>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
||||
|
@ -697,11 +702,6 @@ pub enum PredicateKind<'tcx> {
|
|||
/// Constants must be equal. The first component is the const that is expected.
|
||||
ConstEquate(Const<'tcx>, Const<'tcx>),
|
||||
|
||||
/// Represents a type found in the environment that we can use for implied bounds.
|
||||
///
|
||||
/// Only used for Chalk.
|
||||
TypeWellFormedFromEnv(Ty<'tcx>),
|
||||
|
||||
/// A marker predicate that is always ambiguous.
|
||||
/// Used for coherence to mark opaque types as possibly equal to each other but ambiguous.
|
||||
Ambiguous,
|
||||
|
@ -1425,7 +1425,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1446,7 +1446,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1467,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1483,7 +1483,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
pub fn expect_clause(self) -> Clause<'tcx> {
|
||||
match self.kind().skip_binder() {
|
||||
PredicateKind::Clause(..) => Clause(self.0),
|
||||
_ => bug!(),
|
||||
_ => bug!("{self} is not a clause"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2883,6 +2883,9 @@ define_print_and_forward_display! {
|
|||
ty::ClauseKind::ConstEvaluatable(ct) => {
|
||||
p!("the constant `", print(ct), "` can be evaluated")
|
||||
}
|
||||
ty::ClauseKind::TypeWellFormedFromEnv(ty) => {
|
||||
p!("the type `", print(ty), "` is found in the environment")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2904,9 +2907,6 @@ define_print_and_forward_display! {
|
|||
ty::PredicateKind::ConstEquate(c1, c2) => {
|
||||
p!("the constant `", print(c1), "` equals `", print(c2), "`")
|
||||
}
|
||||
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
|
||||
p!("the type `", print(ty), "` is found in the environment")
|
||||
}
|
||||
ty::PredicateKind::Ambiguous => p!("ambiguous"),
|
||||
ty::PredicateKind::AliasRelate(t1, t2, dir) => p!(print(t1), write(" {} ", dir), print(t2)),
|
||||
}
|
||||
|
|
|
@ -189,6 +189,9 @@ impl<'tcx> fmt::Debug for ty::ClauseKind<'tcx> {
|
|||
ty::ClauseKind::ConstEvaluatable(ct) => {
|
||||
write!(f, "ConstEvaluatable({ct:?})")
|
||||
}
|
||||
ty::ClauseKind::TypeWellFormedFromEnv(ty) => {
|
||||
write!(f, "TypeWellFormedFromEnv({:?})", ty)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,9 +209,6 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
|
|||
write!(f, "ClosureKind({:?}, {:?}, {:?})", closure_def_id, closure_substs, kind)
|
||||
}
|
||||
ty::PredicateKind::ConstEquate(c1, c2) => write!(f, "ConstEquate({:?}, {:?})", c1, c2),
|
||||
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
|
||||
write!(f, "TypeWellFormedFromEnv({:?})", ty)
|
||||
}
|
||||
ty::PredicateKind::Ambiguous => write!(f, "Ambiguous"),
|
||||
ty::PredicateKind::AliasRelate(t1, t2, dir) => {
|
||||
write!(f, "AliasRelate({t1:?}, {dir:?}, {t2:?})")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue