1
Fork 0

Stop using Bubble in coherence and instead emulate it with an intercrate check

This commit is contained in:
Oli Scherer 2024-02-28 12:20:04 +00:00
parent 1547c076bf
commit c98be3254f
2 changed files with 13 additions and 4 deletions

View file

@ -101,6 +101,15 @@ impl<'tcx> InferCtxt<'tcx> {
let process = |a: Ty<'tcx>, b: Ty<'tcx>| match *a.kind() {
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) if def_id.is_local() => {
let def_id = def_id.expect_local();
if self.intercrate {
// See comment on `insert_hidden_type` for why this is sufficient in coherence
return Some(self.register_hidden_type(
OpaqueTypeKey { def_id, args },
cause.clone(),
param_env,
b,
));
}
match self.defining_use_anchor {
DefiningAnchor::Bind(_) => {
// Check that this is `impl Trait` type is
@ -142,8 +151,10 @@ impl<'tcx> InferCtxt<'tcx> {
}
}
DefiningAnchor::Bubble => {}
DefiningAnchor::Error => return None,
};
DefiningAnchor::Error => {
return None;
}
}
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }) = *b.kind() {
// We could accept this, but there are various ways to handle this situation, and we don't
// want to make a decision on it right now. Likely this case is so super rare anyway, that