Skip to content

Commit

Permalink
Stop using Bubble in coherence and instead emulate it with an intercr…
Browse files Browse the repository at this point in the history
…ate check
  • Loading branch information
oli-obk committed Feb 28, 2024
1 parent ef32456 commit d5f39d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion compiler/rustc_infer/src/infer/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ impl<'tcx> InferCtxt<'tcx> {
}
}
DefiningAnchor::Bubble => {}
DefiningAnchor::Error => return None,
DefiningAnchor::Error => {
if !self.intercrate {
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
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_trait_selection/src/traits/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use rustc_infer::traits::{util, TraitEngine, TraitEngineExt};
use rustc_middle::traits::query::NoSolution;
use rustc_middle::traits::solve::{CandidateSource, Certainty, Goal};
use rustc_middle::traits::specialization_graph::OverlapMode;
use rustc_middle::traits::DefiningAnchor;
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
Expand Down Expand Up @@ -190,7 +189,6 @@ fn overlap<'tcx>(

let infcx = tcx
.infer_ctxt()
.with_opaque_type_inference(DefiningAnchor::Bubble)
.skip_leak_check(skip_leak_check.is_yes())
.intercrate(true)
.with_next_trait_solver(tcx.next_trait_solver_in_coherence())
Expand Down

0 comments on commit d5f39d3

Please sign in to comment.