Rollup merge of #112780 - compiler-errors:tait-is-ambig, r=lcnr
Treat TAIT equation as always ambiguous in coherence Not sure why we weren't treating all TAIT equality as ambiguous -- this behavior combined with `DefineOpaqueTypes::No` leads to coherence overlap failures, since we incorrectly consider impls as not overlapping because the obligation `T: From<Foo>` doesn't hold. Fixes #112765
This commit is contained in:
commit
263635b917
6 changed files with 74 additions and 21 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue