mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
Wrap QueryDescription into a macro.
This commit is contained in:
parent
cdc0b199a9
commit
8e5d613a11
@ -344,7 +344,6 @@ fn add_query_description_impl(
|
||||
impls: &mut proc_macro2::TokenStream,
|
||||
) {
|
||||
let name = &query.name;
|
||||
let arg = &query.arg;
|
||||
let key = &query.key.0;
|
||||
|
||||
// Find out if we should cache the query on disk
|
||||
@ -414,7 +413,7 @@ fn add_query_description_impl(
|
||||
|
||||
let desc = quote! {
|
||||
#[allow(unused_variables)]
|
||||
fn describe(tcx: QueryCtxt<'tcx>, key: #arg) -> String {
|
||||
fn describe(tcx: QueryCtxt<'tcx>, key: Self::Key) -> String {
|
||||
let (#tcx, #key) = (*tcx, key);
|
||||
::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc).into())
|
||||
}
|
||||
@ -520,7 +519,8 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
|
||||
$($macro)*(#cached_queries);
|
||||
}
|
||||
}
|
||||
|
||||
#query_description_stream
|
||||
macro_rules! rustc_query_description {
|
||||
() => { #query_description_stream }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,28 +1,3 @@
|
||||
use crate::dep_graph::SerializedDepNodeIndex;
|
||||
use crate::mir::interpret::{GlobalId, LitToConstInput};
|
||||
use crate::traits;
|
||||
use crate::traits::query::{
|
||||
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
|
||||
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
|
||||
CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpSubtypeGoal,
|
||||
};
|
||||
use crate::ty::query::queries;
|
||||
use crate::ty::query::QueryCtxt;
|
||||
use crate::ty::subst::{GenericArg, SubstsRef};
|
||||
use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
|
||||
use rustc_query_system::query::QueryDescription;
|
||||
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
||||
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()))
|
||||
}
|
||||
}
|
||||
|
||||
// Each of these queries corresponds to a function pointer field in the
|
||||
// `Providers` struct for requesting a value of that type, and a method
|
||||
// on `tcx: TyCtxt` (and `tcx.at(span)`) for doing that request in a way
|
||||
|
@ -3,19 +3,19 @@
|
||||
//! manage the caches, and so forth.
|
||||
|
||||
use crate::dep_graph::{self, DepKind, DepNode, DepNodeExt, DepNodeIndex, SerializedDepNodeIndex};
|
||||
use crate::ty::query::{on_disk_cache, Queries, Query};
|
||||
use crate::ty::query::{on_disk_cache, queries, Queries, Query};
|
||||
use crate::ty::tls::{self, ImplicitCtxt};
|
||||
use crate::ty::{self, TyCtxt};
|
||||
use rustc_query_system::dep_graph::HasDepContext;
|
||||
use rustc_query_system::query::QueryContext;
|
||||
use rustc_query_system::query::{CycleError, QueryJobId, QueryJobInfo};
|
||||
use rustc_query_system::query::{QueryContext, QueryDescription};
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_errors::{struct_span_err, Diagnostic, DiagnosticBuilder, Handler, Level};
|
||||
use rustc_serialize::opaque;
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::def_id::{DefId, LocalDefId};
|
||||
use rustc_span::Span;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
@ -797,3 +797,13 @@ macro_rules! define_provider_struct {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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_description! {}
|
||||
|
Loading…
Reference in New Issue
Block a user