1
Fork 0

Remove opaque type obligation and just register opaque types as they are encountered.

This also registers obligations for the hidden type immediately.
This commit is contained in:
Oli Scherer 2022-02-17 13:28:06 +00:00
parent 86e1860495
commit 1163aa7e72
60 changed files with 290 additions and 311 deletions

View file

@ -265,10 +265,6 @@ impl FlagComputation {
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
self.add_ty(ty);
}
ty::PredicateKind::OpaqueType(opaque, ty) => {
self.add_ty(opaque);
self.add_ty(ty);
}
}
}

View file

@ -632,11 +632,6 @@ pub enum PredicateKind<'tcx> {
///
/// Only used for Chalk.
TypeWellFormedFromEnv(Ty<'tcx>),
/// Represents a hidden type assignment for an opaque type.
/// Such obligations get processed by checking whether the item currently being
/// type-checked may acually define it.
OpaqueType(Ty<'tcx>, Ty<'tcx>),
}
/// The crate outlives map is computed during typeck and contains the
@ -1004,7 +999,6 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::TypeOutlives(..)
| PredicateKind::ConstEvaluatable(..)
| PredicateKind::ConstEquate(..)
| PredicateKind::OpaqueType(..)
| PredicateKind::TypeWellFormedFromEnv(..) => None,
}
}
@ -1023,7 +1017,6 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::ClosureKind(..)
| PredicateKind::ConstEvaluatable(..)
| PredicateKind::ConstEquate(..)
| PredicateKind::OpaqueType(..)
| PredicateKind::TypeWellFormedFromEnv(..) => None,
}
}

View file

@ -2654,9 +2654,6 @@ define_print_and_forward_display! {
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
p!("the type `", print(ty), "` is found in the environment")
}
ty::PredicateKind::OpaqueType(a, b) => {
p!("opaque type assigment with `", print(a), "` == `", print(b) ,"`")
}
}
}

View file

@ -198,9 +198,6 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
write!(f, "TypeWellFormedFromEnv({:?})", ty)
}
ty::PredicateKind::OpaqueType(a, b) => {
write!(f, "OpaqueType({:?}, {:?})", a.kind(), b.kind())
}
}
}
}
@ -474,9 +471,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::PredicateKind<'a> {
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
tcx.lift(ty).map(ty::PredicateKind::TypeWellFormedFromEnv)
}
ty::PredicateKind::OpaqueType(opaque, ty) => {
Some(ty::PredicateKind::OpaqueType(tcx.lift(opaque)?, tcx.lift(ty)?))
}
}
}
}