Remove output_filenames field from TyCtxt and feed the query instead

This commit is contained in:
Oli Scherer 2022-12-05 17:00:26 +00:00
parent 33b6a7790e
commit fbe2d5aad2
4 changed files with 4 additions and 9 deletions

View File

@ -822,7 +822,6 @@ pub fn create_global_ctxt<'tcx>(
queries.on_disk_cache.as_ref().map(OnDiskCache::as_dyn), queries.on_disk_cache.as_ref().map(OnDiskCache::as_dyn),
queries.as_dyn(), queries.as_dyn(),
rustc_query_impl::query_callbacks(arena), rustc_query_impl::query_callbacks(arena),
outputs,
) )
}) })
}); });
@ -834,6 +833,7 @@ pub fn create_global_ctxt<'tcx>(
tcx.arena.alloc(Steal::new((untracked_resolver_for_lowering, krate))), tcx.arena.alloc(Steal::new((untracked_resolver_for_lowering, krate))),
); );
feed.resolutions(tcx.arena.alloc(untracked_resolutions)); feed.resolutions(tcx.arena.alloc(untracked_resolutions));
feed.output_filenames(tcx.arena.alloc(std::sync::Arc::new(outputs)));
let feed = tcx.feed_local_crate(); let feed = tcx.feed_local_crate();
feed.crate_name(crate_name); feed.crate_name(crate_name);
}); });

View File

@ -34,6 +34,7 @@ macro_rules! arena_types {
rustc_middle::ty::ResolverAstLowering, rustc_middle::ty::ResolverAstLowering,
rustc_data_structures::sync::Lrc<rustc_ast::Crate>, rustc_data_structures::sync::Lrc<rustc_ast::Crate>,
)>, )>,
[] output_filenames: std::sync::Arc<rustc_session::config::OutputFilenames>,
[] resolutions: rustc_middle::ty::ResolverGlobalCtxt, [] resolutions: rustc_middle::ty::ResolverGlobalCtxt,
[decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult, [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
[decode] code_region: rustc_middle::mir::coverage::CodeRegion, [decode] code_region: rustc_middle::mir::coverage::CodeRegion,

View File

@ -1857,7 +1857,7 @@ rustc_queries! {
/// This query returns an `&Arc` because codegen backends need the value even after the `TyCtxt` /// This query returns an `&Arc` because codegen backends need the value even after the `TyCtxt`
/// has been destroyed. /// has been destroyed.
query output_filenames(_: ()) -> &'tcx Arc<OutputFilenames> { query output_filenames(_: ()) -> &'tcx Arc<OutputFilenames> {
eval_always feedable
desc { "getting output filenames" } desc { "getting output filenames" }
} }

View File

@ -51,7 +51,7 @@ use rustc_macros::HashStable;
use rustc_query_system::dep_graph::DepNodeIndex; use rustc_query_system::dep_graph::DepNodeIndex;
use rustc_query_system::ich::StableHashingContext; use rustc_query_system::ich::StableHashingContext;
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
use rustc_session::config::{CrateType, OutputFilenames}; use rustc_session::config::CrateType;
use rustc_session::cstore::{CrateStoreDyn, Untracked}; use rustc_session::cstore::{CrateStoreDyn, Untracked};
use rustc_session::lint::Lint; use rustc_session::lint::Lint;
use rustc_session::Limit; use rustc_session::Limit;
@ -74,7 +74,6 @@ use std::hash::{Hash, Hasher};
use std::iter; use std::iter;
use std::mem; use std::mem;
use std::ops::{Bound, Deref}; use std::ops::{Bound, Deref};
use std::sync::Arc;
pub trait OnDiskCache<'tcx>: rustc_data_structures::sync::Sync { pub trait OnDiskCache<'tcx>: rustc_data_structures::sync::Sync {
/// Creates a new `OnDiskCache` instance from the serialized data in `data`. /// Creates a new `OnDiskCache` instance from the serialized data in `data`.
@ -460,8 +459,6 @@ pub struct GlobalCtxt<'tcx> {
/// Stores memory for globals (statics/consts). /// Stores memory for globals (statics/consts).
pub(crate) alloc_map: Lock<interpret::AllocMap<'tcx>>, pub(crate) alloc_map: Lock<interpret::AllocMap<'tcx>>,
output_filenames: Arc<OutputFilenames>,
} }
impl<'tcx> TyCtxt<'tcx> { impl<'tcx> TyCtxt<'tcx> {
@ -591,7 +588,6 @@ impl<'tcx> TyCtxt<'tcx> {
on_disk_cache: Option<&'tcx dyn OnDiskCache<'tcx>>, on_disk_cache: Option<&'tcx dyn OnDiskCache<'tcx>>,
queries: &'tcx dyn query::QueryEngine<'tcx>, queries: &'tcx dyn query::QueryEngine<'tcx>,
query_kinds: &'tcx [DepKindStruct<'tcx>], query_kinds: &'tcx [DepKindStruct<'tcx>],
output_filenames: OutputFilenames,
) -> GlobalCtxt<'tcx> { ) -> GlobalCtxt<'tcx> {
let data_layout = s.target.parse_data_layout().unwrap_or_else(|err| { let data_layout = s.target.parse_data_layout().unwrap_or_else(|err| {
s.emit_fatal(err); s.emit_fatal(err);
@ -623,7 +619,6 @@ impl<'tcx> TyCtxt<'tcx> {
evaluation_cache: Default::default(), evaluation_cache: Default::default(),
data_layout, data_layout,
alloc_map: Lock::new(interpret::AllocMap::new()), alloc_map: Lock::new(interpret::AllocMap::new()),
output_filenames: Arc::new(output_filenames),
} }
} }
@ -2407,7 +2402,6 @@ pub fn provide(providers: &mut ty::query::Providers) {
providers.extern_mod_stmt_cnum = providers.extern_mod_stmt_cnum =
|tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned(); |tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned();
providers.output_filenames = |tcx, ()| &tcx.output_filenames;
providers.features_query = |tcx, ()| tcx.sess.features_untracked(); providers.features_query = |tcx, ()| tcx.sess.features_untracked();
providers.is_panic_runtime = |tcx, cnum| { providers.is_panic_runtime = |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE); assert_eq!(cnum, LOCAL_CRATE);