From cd7bbac7c60dd3fc58eebf321071af3093823c4d Mon Sep 17 00:00:00 2001 From: Zalathar Date: Wed, 25 Feb 2026 22:08:30 +1100 Subject: [PATCH] Add some docs for `QueryVTable::execute_query_fn` This function is tricky to document, and there's more that could be said here, but I don't want to take up too much vertical space, or add too much risk of details becoming inaccurate over time. --- compiler/rustc_middle/src/query/plumbing.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/rustc_middle/src/query/plumbing.rs b/compiler/rustc_middle/src/query/plumbing.rs index 41e34f010419..2cd5fcf4f7d6 100644 --- a/compiler/rustc_middle/src/query/plumbing.rs +++ b/compiler/rustc_middle/src/query/plumbing.rs @@ -158,6 +158,15 @@ pub struct QueryVTable<'tcx, C: QueryCache> { /// Used when reporting query cycle errors and similar problems. pub description_fn: fn(TyCtxt<'tcx>, C::Key) -> String, + /// Function pointer that is called by the query methods on [`TyCtxt`] and + /// friends[^1], after they have checked the in-memory cache and found no + /// existing value for this key. + /// + /// Transitive responsibilities include trying to load a disk-cached value + /// if possible (incremental only), invoking the query provider if necessary, + /// and putting the obtained value into the in-memory cache. + /// + /// [^1]: [`TyCtxt`], [`TyCtxtAt`], [`TyCtxtEnsureOk`], [`TyCtxtEnsureDone`] pub execute_query_fn: fn(TyCtxt<'tcx>, Span, C::Key, QueryMode) -> Option, }