Add an always-ambiguous predicate to make sure that we don't accidentlally allow trait resolution to prove false things during coherence
This commit is contained in:
@@ -619,6 +619,7 @@ impl<'tcx> Predicate<'tcx> {
|
||||
| PredicateKind::Coerce(_)
|
||||
| PredicateKind::ConstEvaluatable(_)
|
||||
| PredicateKind::ConstEquate(_, _)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(_) => true,
|
||||
}
|
||||
}
|
||||
@@ -701,6 +702,10 @@ pub enum PredicateKind<'tcx> {
|
||||
///
|
||||
/// 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,
|
||||
}
|
||||
|
||||
/// The crate outlives map is computed during typeck and contains the
|
||||
@@ -1181,6 +1186,7 @@ impl<'tcx> Predicate<'tcx> {
|
||||
| PredicateKind::TypeOutlives(..)
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
}
|
||||
}
|
||||
@@ -1199,6 +1205,7 @@ impl<'tcx> Predicate<'tcx> {
|
||||
| PredicateKind::TypeOutlives(..)
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
}
|
||||
}
|
||||
@@ -1217,6 +1224,7 @@ impl<'tcx> Predicate<'tcx> {
|
||||
| PredicateKind::ClosureKind(..)
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user