Skip to content

Commit d5f39d3

Browse files
committed
Stop using Bubble in coherence and instead emulate it with an intercrate check
1 parent ef32456 commit d5f39d3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/rustc_infer/src/infer/opaque_types.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ impl<'tcx> InferCtxt<'tcx> {
146146
}
147147
}
148148
DefiningAnchor::Bubble => {}
149-
DefiningAnchor::Error => return None,
149+
DefiningAnchor::Error => {
150+
if !self.intercrate {
151+
return None;
152+
}
153+
}
150154
};
151155
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }) = *b.kind() {
152156
// We could accept this, but there are various ways to handle this situation, and we don't

compiler/rustc_trait_selection/src/traits/coherence.rs

-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use rustc_infer::traits::{util, TraitEngine, TraitEngineExt};
2626
use rustc_middle::traits::query::NoSolution;
2727
use rustc_middle::traits::solve::{CandidateSource, Certainty, Goal};
2828
use rustc_middle::traits::specialization_graph::OverlapMode;
29-
use rustc_middle::traits::DefiningAnchor;
3029
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
3130
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
3231
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
@@ -190,7 +189,6 @@ fn overlap<'tcx>(
190189

191190
let infcx = tcx
192191
.infer_ctxt()
193-
.with_opaque_type_inference(DefiningAnchor::Bubble)
194192
.skip_leak_check(skip_leak_check.is_yes())
195193
.intercrate(true)
196194
.with_next_trait_solver(tcx.next_trait_solver_in_coherence())

0 commit comments

Comments
 (0)