From 408ae0fcb9d154691470ce8fc644394c20a97405 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Mon, 5 Dec 2022 16:19:14 +0000 Subject: [PATCH] Feed `resolutions` query instead of it being a thin wrapper around an untracked field --- compiler/rustc_interface/src/passes.rs | 6 +++--- compiler/rustc_middle/src/arena.rs | 1 + compiler/rustc_middle/src/query/mod.rs | 2 +- compiler/rustc_middle/src/ty/context.rs | 6 +----- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 86d56385bc9..e8656e0dbc2 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -817,7 +817,6 @@ pub fn create_global_ctxt<'tcx>( lint_store, arena, hir_arena, - untracked_resolutions, untracked, krate, dep_graph, @@ -832,8 +831,9 @@ pub fn create_global_ctxt<'tcx>( let mut qcx = QueryContext { gcx }; qcx.enter(|tcx| { - tcx.feed_unit_query() - .resolver_for_lowering(tcx.arena.alloc(Steal::new(untracked_resolver_for_lowering))) + let feed = tcx.feed_unit_query(); + feed.resolver_for_lowering(tcx.arena.alloc(Steal::new(untracked_resolver_for_lowering))); + feed.resolutions(tcx.arena.alloc(untracked_resolutions)); }); qcx } diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index 75282f958b5..ca058cc3c6d 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -31,6 +31,7 @@ macro_rules! arena_types { [decode] borrowck_result: rustc_middle::mir::BorrowCheckResult<'tcx>, [] resolver: rustc_data_structures::steal::Steal, + [] resolutions: rustc_middle::ty::ResolverGlobalCtxt, [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult, [decode] code_region: rustc_middle::mir::coverage::CodeRegion, [] const_allocs: rustc_middle::mir::interpret::Allocation, diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 076ce1bdb34..4315247eace 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -27,7 +27,7 @@ rustc_queries! { } query resolutions(_: ()) -> &'tcx ty::ResolverGlobalCtxt { - eval_always + feedable no_hash desc { "getting the resolver outputs" } } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 5de414077a2..276aadcb66b 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -428,8 +428,7 @@ pub struct GlobalCtxt<'tcx> { pub consts: CommonConsts<'tcx>, untracked: Untracked, - /// Output of the resolver. - pub(crate) untracked_resolutions: ty::ResolverGlobalCtxt, + /// The entire crate as AST. This field serves as the input for the hir_crate query, /// which lowers it from AST to HIR. It must not be read or used by anything else. pub untracked_crate: Steal>, @@ -592,7 +591,6 @@ impl<'tcx> TyCtxt<'tcx> { lint_store: Lrc, arena: &'tcx WorkerLocal>, hir_arena: &'tcx WorkerLocal>, - untracked_resolutions: ty::ResolverGlobalCtxt, untracked: Untracked, krate: Lrc, dep_graph: DepGraph, @@ -622,7 +620,6 @@ impl<'tcx> TyCtxt<'tcx> { lifetimes: common_lifetimes, consts: common_consts, untracked, - untracked_resolutions, untracked_crate: Steal::new(krate), on_disk_cache, queries, @@ -2407,7 +2404,6 @@ fn ptr_eq(t: *const T, u: *const U) -> bool { } pub fn provide(providers: &mut ty::query::Providers) { - providers.resolutions = |tcx, ()| &tcx.untracked_resolutions; providers.module_reexports = |tcx, id| tcx.resolutions(()).reexport_map.get(&id).map(|v| &v[..]); providers.crate_name = |tcx, id| {