1
Fork 0

Treat TAIT equation as always ambiguous in coherence

This commit is contained in:
Michael Goulet 2023-06-18 22:10:07 +00:00
parent 939786223f
commit d43683f2e9
6 changed files with 74 additions and 21 deletions

View file

@ -124,13 +124,10 @@ impl<'tcx> InferCtxt<'tcx> {
}
// During coherence, opaque types should be treated as *possibly*
// equal to each other, even if their generic params differ, as
// they could resolve to the same hidden type, even for different
// generic params.
(
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
) if self.intercrate && a_def_id == b_def_id => {
// equal to any other type (except for possibly itself). This is an
// extremely heavy hammer, but can be relaxed in a fowards-compatible
// way later.
(&ty::Alias(ty::Opaque, _), _) | (_, &ty::Alias(ty::Opaque, _)) if self.intercrate => {
relation.register_predicates([ty::Binder::dummy(ty::PredicateKind::Ambiguous)]);
Ok(a)
}