From acad5744cc599be623006f7bd98fa0b13e72f830 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 18 Aug 2020 14:18:45 +0200 Subject: [PATCH] Elaborate docs on the `promoted_mir` query --- src/librustc_middle/query/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustc_middle/query/mod.rs b/src/librustc_middle/query/mod.rs index b22bf530869..15d267e4b1e 100644 --- a/src/librustc_middle/query/mod.rs +++ b/src/librustc_middle/query/mod.rs @@ -282,7 +282,10 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String { } /// The `DefId` is the `DefId` of the containing MIR body. Promoteds to not have their own - /// `DefId`. + /// `DefId`. This function returns all promoteds in the specified body. The body references + /// promoteds by the `DefId` and the `mir::Promoted` index. This is necessary, because + /// after inlining a body may refer to promoteds from other bodies. In that case you still + /// need to use the `DefId` of the original body. query promoted_mir(key: DefId) -> &'tcx IndexVec> { desc { |tcx| "optimizing promoted MIR for `{}`", tcx.def_path_str(key) } cache_on_disk_if { key.is_local() } -- 2.44.0