]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_query_impl/src/lib.rs
Rollup merge of #99386 - AngelicosPhosphoros:add_retain_test_maybeuninit, r=JohnTitor
[rust.git] / compiler / rustc_query_impl / src / lib.rs
1 //! Support for serializing the dep-graph and reloading it.
2
3 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
4 #![feature(min_specialization)]
5 #![feature(never_type)]
6 #![feature(once_cell)]
7 #![feature(rustc_attrs)]
8 #![recursion_limit = "256"]
9 #![allow(rustc::potential_query_instability)]
10 #![deny(rustc::untranslatable_diagnostic)]
11 #![deny(rustc::diagnostic_outside_of_impl)]
12
13 #[macro_use]
14 extern crate rustc_macros;
15 #[macro_use]
16 extern crate rustc_middle;
17
18 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
19 use rustc_data_structures::sync::AtomicU64;
20 use rustc_middle::arena::Arena;
21 use rustc_middle::dep_graph::{self, DepKindStruct, SerializedDepNodeIndex};
22 use rustc_middle::ty::query::{query_keys, query_storage, query_stored, query_values};
23 use rustc_middle::ty::query::{ExternProviders, Providers, QueryEngine};
24 use rustc_middle::ty::{self, TyCtxt};
25 use rustc_span::def_id::{LocalDefId, LOCAL_CRATE};
26 use rustc_span::Span;
27
28 #[macro_use]
29 mod plumbing;
30 pub use plumbing::QueryCtxt;
31 use rustc_query_system::query::*;
32 #[cfg(parallel_compiler)]
33 pub use rustc_query_system::query::{deadlock, QueryContext};
34
35 mod keys;
36 use keys::Key;
37
38 mod values;
39 use self::values::Value;
40
41 pub use rustc_query_system::query::QueryConfig;
42 pub(crate) use rustc_query_system::query::{QueryDescription, QueryVTable};
43
44 mod on_disk_cache;
45 pub use on_disk_cache::OnDiskCache;
46
47 mod profiling_support;
48 pub use self::profiling_support::alloc_self_profile_query_strings;
49
50 fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
51     if def_id.is_top_level_module() {
52         "top-level module".to_string()
53     } else {
54         format!("module `{}`", tcx.def_path_str(def_id.to_def_id()))
55     }
56 }
57
58 rustc_query_append! { [define_queries!][<'tcx>] }
59
60 impl<'tcx> Queries<'tcx> {
61     // Force codegen in the dyn-trait transformation in this crate.
62     pub fn as_dyn(&'tcx self) -> &'tcx dyn QueryEngine<'tcx> {
63         self
64     }
65 }