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 ee25694

Browse files
committedMar 5, 2024·
Auto merge of rust-lang#121796 - oli-obk:eager_opaque_checks3, r=<try>
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 (not done in this PR) The only behaviour change is in diagnostics. r? `@lcnr` `@compiler-errors`
2 parents c7beecf + 04461ee commit ee25694

Some content is hidden

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

51 files changed

+316
-280
lines changed
 

‎compiler/rustc_borrowck/src/consumers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ 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.infer_ctxt().with_opaque_type_inference(DefiningAnchor::bind(tcx, def)).build();
110110
let input_body: &Body<'_> = &input_body.borrow();
111111
let promoted: &IndexSlice<_, _> = &promoted.borrow();
112112
*super::do_mir_borrowck(&infcx, input_body, promoted, Some(options)).1.unwrap()

‎compiler/rustc_borrowck/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ 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(tcx, hir_owner.def_id))
133+
.build();
132134
let promoted: &IndexSlice<_, _> = &promoted.borrow();
133135
let opt_closure_req = do_mir_borrowck(&infcx, input_body, promoted, None).0;
134136
debug!("mir_borrowck done");

0 commit comments

Comments
 (0)