Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d72008e

Browse files
committedFeb 29, 2024·
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
1 parent ef32456 commit d72008e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+312
-225
lines changed
 

‎compiler/rustc_borrowck/src/consumers.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ pub fn get_body_with_borrowck_facts(
106106
options: ConsumerOptions,
107107
) -> BodyWithBorrowckFacts<'_> {
108108
let (input_body, promoted) = tcx.mir_promoted(def);
109-
let infcx = tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bind(def)).build();
109+
let infcx = tcx
110+
.infer_ctxt()
111+
.with_opaque_type_inference(DefiningAnchor::Bind(tcx.opaque_types_defined_by(def)))
112+
.build();
110113
let input_body: &Body<'_> = &input_body.borrow();
111114
let promoted: &IndexSlice<_, _> = &promoted.borrow();
112115
*super::do_mir_borrowck(&infcx, input_body, promoted, Some(options)).1.unwrap()

‎compiler/rustc_borrowck/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,12 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
127127

128128
let hir_owner = tcx.local_def_id_to_hir_id(def).owner;
129129

130-
let infcx =
131-
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bind(hir_owner.def_id)).build();
130+
let infcx = tcx
131+
.infer_ctxt()
132+
.with_opaque_type_inference(DefiningAnchor::Bind(
133+
tcx.opaque_types_defined_by(hir_owner.def_id),
134+
))
135+
.build();
132136
let promoted: &IndexSlice<_, _> = &promoted.borrow();
133137
let opt_closure_req = do_mir_borrowck(&infcx, input_body, promoted, None).0;
134138
debug!("mir_borrowck done");

0 commit comments

Comments
 (0)
Please sign in to comment.