about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/queries.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-29 21:58:13 +0000
committerbors <bors@rust-lang.org>2023-04-29 21:58:13 +0000
commitf5adff6bd8b29ac7dd173b36f0c8c35bb1c593c5 (patch)
tree0af42fdb67cd5ee8e9100915fda59e84efec4029 /compiler/rustc_interface/src/queries.rs
parent87b1f891ea76713462cfc5a15137a8fe2b24ecc2 (diff)
parentb6943736bd37e0e932089c27dd0638f0a7ddc3fe (diff)
downloadrust-f5adff6bd8b29ac7dd173b36f0c8c35bb1c593c5.tar.gz
rust-f5adff6bd8b29ac7dd173b36f0c8c35bb1c593c5.zip
Auto merge of #109611 - Zoxc:query-engine-rem, r=cjgillot
Remove `QueryEngine` trait

This removes the `QueryEngine` trait and `Queries` from `rustc_query_impl` and replaced them with function pointers and fields in `QuerySystem`. As a side effect `OnDiskCache` is moved back into `rustc_middle` and the `OnDiskCache` trait is also removed.

This has a couple of benefits.
- `TyCtxt` is used in the query system instead of the removed `QueryCtxt` which is larger.
- Function pointers are more flexible to work with. A variant of https://github.com/rust-lang/rust/pull/107802 is included which avoids the double indirection. For https://github.com/rust-lang/rust/pull/108938 we can name entry point `__rust_end_short_backtrace` to avoid some overhead. For https://github.com/rust-lang/rust/pull/108062 it avoids the duplicate `QueryEngine` structs.
- `QueryContext` now implements `DepContext` which avoids many `dep_context()` calls in `rustc_query_system`.
- The `rustc_driver` size is reduced by 0.33%, hopefully that means some bootstrap improvements.
- This avoids the unsafe code around the `QueryEngine` trait.

r? `@cjgillot`
Diffstat (limited to 'compiler/rustc_interface/src/queries.rs')
-rw-r--r--compiler/rustc_interface/src/queries.rs4
1 files changed, 0 insertions, 4 deletions
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs
index 818f450a58c..77fbbf64a0a 100644
--- a/compiler/rustc_interface/src/queries.rs
+++ b/compiler/rustc_interface/src/queries.rs
@@ -16,7 +16,6 @@ use rustc_metadata::creader::CStore;
 use rustc_middle::arena::Arena;
 use rustc_middle::dep_graph::DepGraph;
 use rustc_middle::ty::{GlobalCtxt, TyCtxt};
-use rustc_query_impl::Queries as TcxQueries;
 use rustc_session::config::{self, OutputFilenames, OutputType};
 use rustc_session::cstore::Untracked;
 use rustc_session::{output::find_crate_name, Session};
@@ -81,7 +80,6 @@ impl<T> Default for Query<T> {
 pub struct Queries<'tcx> {
     compiler: &'tcx Compiler,
     gcx_cell: OnceCell<GlobalCtxt<'tcx>>,
-    queries: OnceCell<TcxQueries<'tcx>>,
 
     arena: WorkerLocal<Arena<'tcx>>,
     hir_arena: WorkerLocal<rustc_hir::Arena<'tcx>>,
@@ -102,7 +100,6 @@ impl<'tcx> Queries<'tcx> {
         Queries {
             compiler,
             gcx_cell: OnceCell::new(),
-            queries: OnceCell::new(),
             arena: WorkerLocal::new(|_| Arena::default()),
             hir_arena: WorkerLocal::new(|_| rustc_hir::Arena::default()),
             dep_graph_future: Default::default(),
@@ -225,7 +222,6 @@ impl<'tcx> Queries<'tcx> {
                 lint_store,
                 self.dep_graph()?.steal(),
                 untracked,
-                &self.queries,
                 &self.gcx_cell,
                 &self.arena,
                 &self.hir_arena,