Skip to content

Commit 0fbb011

Browse files
Rollup merge of rust-lang#89615 - willcrichton:fix-get-body-with-borrowck-facts, r=oli-obk
Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts `mir_borrowck` uses `with_opaque_type_inference` before calling `do_mir_borrowck`: https://github.com/rust-lang/rust/blob/0eabf25b90396dead0b2a1aaa275af18a1ae6008/compiler/rustc_borrowck/src/lib.rs#L132 However `get_body_with_borrowck_facts` does not. Therefore I get an ICE eg when calling this function on the bodies of an async function as described here: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20ICE.20when.20using.20get_body_with_borrowck_facts.20with.20async This change fixes that bug. r? `@nikomatsakis`
2 parents e32328b + 549a68b commit 0fbb011

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_borrowck/src/consumers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn get_body_with_borrowck_facts<'tcx>(
3131
def: ty::WithOptConstParam<LocalDefId>,
3232
) -> BodyWithBorrowckFacts<'tcx> {
3333
let (input_body, promoted) = tcx.mir_promoted(def);
34-
tcx.infer_ctxt().enter(|infcx| {
34+
tcx.infer_ctxt().with_opaque_type_inference(def.did).enter(|infcx| {
3535
let input_body: &Body<'_> = &input_body.borrow();
3636
let promoted: &IndexVec<_, _> = &promoted.borrow();
3737
*super::do_mir_borrowck(&infcx, input_body, promoted, true).1.unwrap()

0 commit comments

Comments
 (0)