From 13e7b237fdc774c4df131f55233f0f5af737a333 Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Mon, 24 May 2021 15:05:20 +0200 Subject: [PATCH] Add comments about stealing THIR in `mir_build` --- compiler/rustc_mir_build/src/build/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index b5d26e81a51..df68c63ea00 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -118,6 +118,8 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam) -> Body<'_ let body = tcx.hir().body(body_id); let (thir, expr) = tcx.thir_body(def); + // We ran all queries that depended on THIR at the beginning + // of `mir_build`, so now we can steal it let thir = thir.steal(); let ty = tcx.type_of(fn_def_id); let mut abi = fn_sig.abi; @@ -227,6 +229,8 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam) -> Body<'_ let return_ty = typeck_results.node_type(id); let (thir, expr) = tcx.thir_body(def); + // We ran all queries that depended on THIR at the beginning + // of `mir_build`, so now we can steal it let thir = thir.steal(); build::construct_const(&thir, &infcx, expr, def, id, return_ty, return_ty_span)