rust/compiler/rustc_query_impl/src/lib.rs

63 lines
1.8 KiB
Rust
Raw Normal View History

//! Support for serializing the dep-graph and reloading it.
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2021-06-28 14:12:01 -05:00
#![feature(crate_visibility_modifier)]
#![feature(nll)]
#![feature(min_specialization)]
2021-06-28 14:12:01 -05:00
#![feature(once_cell)]
#![feature(rustc_attrs)]
#![recursion_limit = "256"]
2022-02-23 07:06:22 -06:00
#![allow(rustc::potential_query_instability)]
2021-06-28 14:12:01 -05:00
#[macro_use]
extern crate rustc_macros;
#[macro_use]
extern crate rustc_middle;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::AtomicU64;
2021-10-16 14:12:34 -05:00
use rustc_middle::arena::Arena;
2021-10-17 10:37:20 -05:00
use rustc_middle::dep_graph::{self, DepKindStruct, SerializedDepNodeIndex};
use rustc_middle::ty::query::{query_keys, query_storage, query_stored, query_values};
use rustc_middle::ty::query::{ExternProviders, Providers, QueryEngine};
2020-12-26 09:36:55 -06:00
use rustc_middle::ty::{self, TyCtxt};
2021-10-17 10:37:20 -05:00
use rustc_span::def_id::LocalDefId;
2020-11-02 13:05:10 -06:00
use rustc_span::Span;
#[macro_use]
mod plumbing;
pub use plumbing::QueryCtxt;
use rustc_query_system::query::*;
mod keys;
use keys::Key;
mod values;
use self::values::Value;
pub use rustc_query_system::query::QueryConfig;
2021-10-17 10:37:20 -05:00
pub(crate) use rustc_query_system::query::{QueryDescription, QueryVtable};
2021-06-28 14:12:01 -05:00
mod on_disk_cache;
pub use on_disk_cache::OnDiskCache;
mod profiling_support;
pub use self::profiling_support::alloc_self_profile_query_strings;
2021-10-17 10:37:20 -05:00
fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
if def_id.is_top_level_module() {
"top-level module".to_string()
} else {
format!("module `{}`", tcx.def_path_str(def_id.to_def_id()))
}
}
rustc_query_append! { [define_queries!][<'tcx>] }
impl<'tcx> Queries<'tcx> {
// Force codegen in the dyn-trait transformation in this crate.
pub fn as_dyn(&'tcx self) -> &'tcx dyn QueryEngine<'tcx> {
self
}
}