Make DefiningAnchor::Bind only store the opaque types that may be constrained, instead of the current infcx root item.

This makes `Bind` almost always be empty, so we can start forwarding it to queries, allowing us to remove `Bubble` entirely
This commit is contained in:
Oli Scherer 2024-02-29 12:21:20 +00:00
parent 65cd843ae0
commit 40d5609548
47 changed files with 300 additions and 229 deletions

View file

@ -347,7 +347,7 @@ fn check_opaque_meets_bounds<'tcx>(
let infcx = tcx
.infer_ctxt()
.with_opaque_type_inference(DefiningAnchor::Bind(defining_use_anchor))
.with_opaque_type_inference(DefiningAnchor::bind(tcx, defining_use_anchor))
.build();
let ocx = ObligationCtxt::new(&infcx);
@ -1558,7 +1558,7 @@ pub(super) fn check_coroutine_obligations(
.ignoring_regions()
// Bind opaque types to type checking root, as they should have been checked by borrowck,
// but may show up in some cases, like when (root) obligations are stalled in the new solver.
.with_opaque_type_inference(DefiningAnchor::Bind(typeck.hir_owner.def_id))
.with_opaque_type_inference(DefiningAnchor::bind(tcx, typeck.hir_owner.def_id))
.build();
let mut fulfillment_cx = <dyn TraitEngine<'_>>::new(&infcx);