]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_query_impl/src/lib.rs
New upstream version 1.60.0+dfsg1
[rustc.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(crate_visibility_modifier)]
5 #![feature(nll)]
6 #![feature(min_specialization)]
7 #![feature(once_cell)]
8 #![feature(rustc_attrs)]
9 #![recursion_limit = "256"]
10 #![cfg_attr(not(bootstrap), allow(rustc::potential_query_instability))]
11
12 #[macro_use]
13 extern crate rustc_macros;
14 #[macro_use]
15 extern crate rustc_middle;
16
17 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
18 use rustc_data_structures::sync::AtomicU64;
19 use rustc_middle::arena::Arena;
20 use rustc_middle::dep_graph::{self, DepKindStruct, SerializedDepNodeIndex};
21 use rustc_middle::ty::query::{query_keys, query_storage, query_stored, query_values};
22 use rustc_middle::ty::query::{ExternProviders, Providers, QueryEngine};
23 use rustc_middle::ty::{self, TyCtxt};
24 use rustc_span::def_id::LocalDefId;
25 use rustc_span::Span;
26
27 #[macro_use]
28 mod plumbing;
29 pub use plumbing::QueryCtxt;
30 use rustc_query_system::query::*;
31
32 mod keys;
33 use keys::Key;
34
35 mod values;
36 use self::values::Value;
37
38 pub use rustc_query_system::query::QueryConfig;
39 pub(crate) use rustc_query_system::query::{QueryDescription, QueryVtable};
40
41 mod on_disk_cache;
42 pub use on_disk_cache::OnDiskCache;
43
44 mod profiling_support;
45 pub use self::profiling_support::alloc_self_profile_query_strings;
46
47 mod util;
48
49 fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
50 if def_id.is_top_level_module() {
51 "top-level module".to_string()
52 } else {
53 format!("module `{}`", tcx.def_path_str(def_id.to_def_id()))
54 }
55 }
56
57 rustc_query_append! { [define_queries!][<'tcx>] }
58
59 impl<'tcx> Queries<'tcx> {
60 // Force codegen in the dyn-trait transformation in this crate.
61 pub fn as_dyn(&'tcx self) -> &'tcx dyn QueryEngine<'tcx> {
62 self
63 }
64 }