about summary refs log tree commit diff
path: root/compiler/rustc_query_system/src
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-08-29 10:20:14 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-09-01 18:47:54 -0500
commit4e09a13bb848a64acf6bb20359f582e813e74764 (patch)
treed23e7f5bf456b2d3b4c5e3cb1ea6ed7ae724f7ed /compiler/rustc_query_system/src
parent4fcc7452666a82c677ae6563bad31c852c258215 (diff)
downloadrust-4e09a13bb848a64acf6bb20359f582e813e74764.tar.gz
rust-4e09a13bb848a64acf6bb20359f582e813e74764.zip
Don't create two new closures for each query
- Parameterize DepKindStruct over `'tcx`

    This allows passing in an invariant function pointer in `query_callback`,
    rather than having to try and make it work for any lifetime.

- Add a new `execute_query` function to `QueryDescription` so we can call `tcx.$name` without needing to be in a macro context
Diffstat (limited to 'compiler/rustc_query_system/src')
-rw-r--r--compiler/rustc_query_system/src/query/config.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_query_system/src/query/config.rs b/compiler/rustc_query_system/src/query/config.rs
index bd0fd7ac350..ea38df836cb 100644
--- a/compiler/rustc_query_system/src/query/config.rs
+++ b/compiler/rustc_query_system/src/query/config.rs
@@ -73,4 +73,7 @@ pub trait QueryDescription<CTX: QueryContext>: QueryConfig {
     fn make_vtable(tcx: CTX, key: &Self::Key) -> QueryVTable<CTX, Self::Key, Self::Value>;
 
     fn cache_on_disk(tcx: CTX::DepContext, key: &Self::Key) -> bool;
+
+    // Don't use this method to compute query results, instead use the methods on TyCtxt
+    fn execute_query(tcx: CTX::DepContext, k: Self::Key) -> Self::Stored;
 }