1 //! Support for serializing the dep-graph and reloading it.
3 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
4 #![feature(min_specialization)]
5 #![feature(never_type)]
7 #![feature(rustc_attrs)]
8 #![recursion_limit = "256"]
9 #![allow(rustc::potential_query_instability)]
12 extern crate rustc_macros;
14 extern crate rustc_middle;
16 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
17 use rustc_data_structures::sync::AtomicU64;
18 use rustc_middle::arena::Arena;
19 use rustc_middle::dep_graph::{self, DepKindStruct, SerializedDepNodeIndex};
20 use rustc_middle::ty::query::{query_keys, query_storage, query_stored, query_values};
21 use rustc_middle::ty::query::{ExternProviders, Providers, QueryEngine};
22 use rustc_middle::ty::{self, TyCtxt};
23 use rustc_span::def_id::{LocalDefId, LOCAL_CRATE};
28 pub use plumbing::QueryCtxt;
29 use rustc_query_system::query::*;
30 #[cfg(parallel_compiler)]
31 pub use rustc_query_system::query::{deadlock, QueryContext};
37 use self::values::Value;
39 pub use rustc_query_system::query::QueryConfig;
40 pub(crate) use rustc_query_system::query::{QueryDescription, QueryVTable};
43 pub use on_disk_cache::OnDiskCache;
45 mod profiling_support;
46 pub use self::profiling_support::alloc_self_profile_query_strings;
48 fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
49 if def_id.is_top_level_module() {
50 "top-level module".to_string()
52 format!("module `{}`", tcx.def_path_str(def_id.to_def_id()))
56 rustc_query_append! { [define_queries!][<'tcx>] }
58 impl<'tcx> Queries<'tcx> {
59 // Force codegen in the dyn-trait transformation in this crate.
60 pub fn as_dyn(&'tcx self) -> &'tcx dyn QueryEngine<'tcx> {