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