2019-02-05 11:20:45 -06:00
|
|
|
use crate::dep_graph::SerializedDepNodeIndex;
|
|
|
|
use crate::dep_graph::DepNode;
|
|
|
|
use crate::hir::def_id::{CrateNum, DefId, DefIndex};
|
|
|
|
use crate::mir::interpret::GlobalId;
|
|
|
|
use crate::traits;
|
|
|
|
use crate::traits::query::{
|
2018-10-23 20:31:57 -04:00
|
|
|
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
|
|
|
|
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
|
|
|
|
CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpSubtypeGoal,
|
2018-06-11 10:33:37 -04:00
|
|
|
};
|
2019-02-05 11:20:45 -06:00
|
|
|
use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt};
|
2019-02-09 22:11:53 +08:00
|
|
|
use crate::ty::subst::SubstsRef;
|
2019-02-05 11:20:45 -06:00
|
|
|
use crate::ty::query::queries;
|
|
|
|
use crate::ty::query::Query;
|
|
|
|
use crate::ty::query::QueryCache;
|
2019-01-24 20:05:19 +01:00
|
|
|
use crate::ty::query::plumbing::CycleError;
|
2019-02-05 11:20:45 -06:00
|
|
|
use crate::util::profiling::ProfileCategory;
|
2017-09-18 05:40:13 -04:00
|
|
|
|
2018-10-01 15:31:27 +02:00
|
|
|
use std::borrow::Cow;
|
2017-09-18 05:40:13 -04:00
|
|
|
use std::hash::Hash;
|
2018-04-19 02:33:24 +02:00
|
|
|
use std::fmt::Debug;
|
2017-09-18 05:40:13 -04:00
|
|
|
use syntax_pos::symbol::InternedString;
|
2018-04-18 04:35:40 +02:00
|
|
|
use rustc_data_structures::sync::Lock;
|
2019-01-20 05:44:02 +01:00
|
|
|
use rustc_data_structures::fingerprint::Fingerprint;
|
2019-02-05 11:20:45 -06:00
|
|
|
use crate::ich::StableHashingContext;
|
2017-09-18 05:40:13 -04:00
|
|
|
|
2018-06-13 16:44:43 +03:00
|
|
|
// Query configuration and description traits.
|
2017-09-18 05:40:13 -04:00
|
|
|
|
2018-04-18 04:35:40 +02:00
|
|
|
pub trait QueryConfig<'tcx> {
|
2018-04-19 02:33:24 +02:00
|
|
|
const NAME: &'static str;
|
2018-05-19 13:50:58 -04:00
|
|
|
const CATEGORY: ProfileCategory;
|
2018-04-19 02:33:24 +02:00
|
|
|
|
|
|
|
type Key: Eq + Hash + Clone + Debug;
|
2019-01-20 05:44:02 +01:00
|
|
|
type Value: Clone;
|
2018-06-13 16:44:43 +03:00
|
|
|
}
|
2018-04-18 04:35:40 +02:00
|
|
|
|
2018-06-13 16:44:43 +03:00
|
|
|
pub(super) trait QueryAccessors<'tcx>: QueryConfig<'tcx> {
|
2018-04-18 04:35:40 +02:00
|
|
|
fn query(key: Self::Key) -> Query<'tcx>;
|
2018-04-27 12:08:54 +02:00
|
|
|
|
|
|
|
// Don't use this method to access query results, instead use the methods on TyCtxt
|
2018-06-13 16:44:43 +03:00
|
|
|
fn query_cache<'a>(tcx: TyCtxt<'a, 'tcx, '_>) -> &'a Lock<QueryCache<'tcx, Self>>;
|
2018-04-19 02:33:24 +02:00
|
|
|
|
|
|
|
fn to_dep_node(tcx: TyCtxt<'_, 'tcx, '_>, key: &Self::Key) -> DepNode;
|
|
|
|
|
2018-04-27 12:08:54 +02:00
|
|
|
// Don't use this method to compute query results, instead use the methods on TyCtxt
|
2018-04-19 02:33:24 +02:00
|
|
|
fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value;
|
|
|
|
|
2019-01-20 05:44:02 +01:00
|
|
|
fn hash_result(
|
|
|
|
hcx: &mut StableHashingContext<'_>,
|
|
|
|
result: &Self::Value
|
|
|
|
) -> Option<Fingerprint>;
|
|
|
|
|
2019-01-24 20:05:19 +01:00
|
|
|
fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>, error: CycleError<'tcx>) -> Self::Value;
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
|
2018-06-13 16:44:43 +03:00
|
|
|
pub(super) trait QueryDescription<'tcx>: QueryAccessors<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, key: Self::Key) -> Cow<'static, str>;
|
2017-11-14 19:52:49 +01:00
|
|
|
|
2017-12-04 20:08:25 +01:00
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, _: Self::Key) -> bool {
|
2017-11-14 19:52:49 +01:00
|
|
|
false
|
|
|
|
}
|
|
|
|
|
2017-11-29 12:42:59 +01:00
|
|
|
fn try_load_from_disk(_: TyCtxt<'_, 'tcx, 'tcx>,
|
|
|
|
_: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2017-12-04 20:08:25 +01:00
|
|
|
bug!("QueryDescription::load_from_disk() called for an unsupported query.")
|
2017-11-14 19:52:49 +01:00
|
|
|
}
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
|
2018-06-13 16:44:43 +03:00
|
|
|
impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M {
|
2018-10-01 15:31:27 +02:00
|
|
|
default fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2017-09-11 13:09:14 -04:00
|
|
|
if !tcx.sess.verbose() {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("processing `{}`", tcx.def_path_str(def_id)).into()
|
2017-09-11 13:09:14 -04:00
|
|
|
} else {
|
|
|
|
let name = unsafe { ::std::intrinsics::type_name::<M>() };
|
2018-06-06 22:13:52 +02:00
|
|
|
format!("processing {:?} with query `{}`", def_id, name).into()
|
2017-09-11 13:09:14 -04:00
|
|
|
}
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-06 22:13:52 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_attrs<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking attributes in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_unstable_api_usage<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking for unstable API usage in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_loops<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking loops in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_item_types<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking item types in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-08 19:14:03 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_privacy<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking privacy in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_intrinsics<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking intrinsics in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_liveness<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking liveness of variables in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-26 12:18:32 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_mod_impl_wf<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("checking that impls are well-formed in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-06 22:13:52 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::collect_mod_item_types<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: DefId,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("collecting item types in {}", key.describe_as_module(tcx)).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-25 10:58:54 -05:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::normalize_projection_ty<'tcx> {
|
|
|
|
fn describe(
|
2018-08-29 22:02:42 -07:00
|
|
|
_tcx: TyCtxt<'_, '_, '_>,
|
2018-02-25 10:58:54 -05:00
|
|
|
goal: CanonicalProjectionGoal<'tcx>,
|
2018-10-01 15:31:27 +02:00
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("normalizing `{:?}`", goal).into()
|
2018-02-21 10:55:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-04 13:07:45 -05:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::implied_outlives_bounds<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> Cow<'static, str> {
|
|
|
|
format!("computing implied outlives bounds for `{:?}`", goal).into()
|
2018-07-04 13:07:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-21 10:55:16 -05:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::dropck_outlives<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> Cow<'static, str> {
|
|
|
|
format!("computing dropck types for `{:?}`", goal).into()
|
2018-02-21 11:24:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::normalize_ty_after_erasing_regions<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: ParamEnvAnd<'tcx, Ty<'tcx>>) -> Cow<'static, str> {
|
|
|
|
format!("normalizing `{:?}`", goal).into()
|
2018-02-25 10:58:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-08 18:30:37 -06:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::evaluate_obligation<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalPredicateGoal<'tcx>) -> Cow<'static, str> {
|
|
|
|
format!("evaluating trait selection obligation `{}`", goal.value.value).into()
|
2018-03-08 18:30:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-24 20:18:16 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::evaluate_goal<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
_tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
goal: traits::ChalkCanonicalGoal<'tcx>
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("evaluating trait selection obligation `{}`", goal.value.goal).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-23 20:31:57 -04:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_ascribe_user_type<'tcx> {
|
|
|
|
fn describe(
|
|
|
|
_tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("evaluating `type_op_ascribe_user_type` `{:?}`", goal).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-11 10:33:37 -04:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_eq<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpEqGoal<'tcx>) -> Cow<'static, str> {
|
|
|
|
format!("evaluating `type_op_eq` `{:?}`", goal).into()
|
2018-06-11 10:33:37 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-11 10:50:16 -04:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_subtype<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpSubtypeGoal<'tcx>)
|
|
|
|
-> Cow<'static, str> {
|
|
|
|
format!("evaluating `type_op_subtype` `{:?}`", goal).into()
|
2018-06-11 10:50:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-11 11:29:46 -04:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_prove_predicate<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpProvePredicateGoal<'tcx>)
|
|
|
|
-> Cow<'static, str> {
|
|
|
|
format!("evaluating `type_op_prove_predicate` `{:?}`", goal).into()
|
2018-06-11 11:29:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-11 11:56:06 -04:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_ty<'tcx> {
|
2018-08-29 22:02:42 -07:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>,
|
2018-10-01 15:31:27 +02:00
|
|
|
goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>) -> Cow<'static, str> {
|
|
|
|
format!("normalizing `{:?}`", goal).into()
|
2018-06-11 11:56:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_predicate<'tcx> {
|
|
|
|
fn describe(
|
2018-08-29 22:02:42 -07:00
|
|
|
_tcx: TyCtxt<'_, '_, '_>,
|
2018-06-11 11:56:06 -04:00
|
|
|
goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Predicate<'tcx>>,
|
2018-10-01 15:31:27 +02:00
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("normalizing `{:?}`", goal).into()
|
2018-06-11 11:56:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_poly_fn_sig<'tcx> {
|
|
|
|
fn describe(
|
2018-08-29 22:02:42 -07:00
|
|
|
_tcx: TyCtxt<'_, '_, '_>,
|
2018-06-11 11:56:06 -04:00
|
|
|
goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>,
|
2018-10-01 15:31:27 +02:00
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!("normalizing `{:?}`", goal).into()
|
2018-06-11 11:56:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_fn_sig<'tcx> {
|
2018-08-29 22:02:42 -07:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>,
|
2018-10-01 15:31:27 +02:00
|
|
|
goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>) -> Cow<'static, str> {
|
|
|
|
format!("normalizing `{:?}`", goal).into()
|
2018-06-11 11:56:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_copy_raw<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
|
|
|
|
-> Cow<'static, str> {
|
|
|
|
format!("computing whether `{}` is `Copy`", env.value).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_sized_raw<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
|
|
|
|
-> Cow<'static, str> {
|
|
|
|
format!("computing whether `{}` is `Sized`", env.value).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_freeze_raw<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
|
|
|
|
-> Cow<'static, str> {
|
|
|
|
format!("computing whether `{}` is freeze", env.value).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::needs_drop_raw<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
|
|
|
|
-> Cow<'static, str> {
|
|
|
|
format!("computing whether `{}` needs drop", env.value).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::layout_raw<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
|
|
|
|
-> Cow<'static, str> {
|
|
|
|
format!("computing layout of `{}`", env.value).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::super_predicates_of<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
format!("computing the supertraits of `{}`",
|
2018-12-19 12:31:35 +02:00
|
|
|
tcx.def_path_str(def_id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::erase_regions_ty<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>) -> Cow<'static, str> {
|
|
|
|
format!("erasing regions from `{:?}`", ty).into()
|
2017-10-17 11:24:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::type_param_predicates<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, (_, def_id): (DefId, DefId)) -> Cow<'static, str> {
|
2019-03-04 09:00:30 +01:00
|
|
|
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
2017-09-18 05:40:13 -04:00
|
|
|
format!("computing the bounds for type parameter `{}`",
|
2018-12-04 13:45:36 +01:00
|
|
|
tcx.hir().ty_param_name(id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::coherent_trait<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
format!("coherence checking all impls of trait `{}`",
|
2018-12-19 12:31:35 +02:00
|
|
|
tcx.def_path_str(def_id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-06 10:33:42 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::upstream_monomorphizations<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, k: CrateNum) -> Cow<'static, str> {
|
|
|
|
format!("collecting available upstream monomorphizations `{:?}`", k).into()
|
2018-03-06 10:33:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::crate_inherent_impls<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, k: CrateNum) -> Cow<'static, str> {
|
|
|
|
format!("all inherent impls defined in crate `{:?}`", k).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::crate_inherent_impls_overlap_check<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"check for overlap between inherent impls defined in this crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::crate_variances<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"computing the variances for items in this crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-15 01:13:56 -04:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::inferred_outlives_crate<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"computing the inferred outlives predicates for items in this crate".into()
|
2017-10-15 01:13:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::mir_shims<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def: ty::InstanceDef<'tcx>) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
format!("generating MIR shim for `{}`",
|
2018-12-19 12:31:35 +02:00
|
|
|
tcx.def_path_str(def.def_id())).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::privacy_access_levels<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"privacy access levels".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-06 04:50:50 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::check_private_in_public<'tcx> {
|
2019-02-23 16:40:15 +01:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
2019-03-06 04:50:50 +01:00
|
|
|
"checking for private elements in public interfaces".into()
|
2019-02-23 16:40:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::typeck_item_bodies<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"type-checking all item bodies".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::reachable_set<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"reachability".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::const_eval<'tcx> {
|
2018-08-26 15:19:34 +02:00
|
|
|
fn describe(
|
|
|
|
tcx: TyCtxt<'_, '_, '_>,
|
|
|
|
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
|
|
|
|
) -> Cow<'static, str> {
|
|
|
|
format!(
|
|
|
|
"const-evaluating + checking `{}`",
|
2018-12-19 12:31:35 +02:00
|
|
|
tcx.def_path_str(key.value.instance.def.def_id()),
|
2018-08-26 15:19:34 +02:00
|
|
|
).into()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, _key: Self::Key) -> bool {
|
2018-08-26 15:19:34 +02:00
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
|
|
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id).map(Ok)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::const_eval_raw<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
|
|
|
|
-> Cow<'static, str>
|
|
|
|
{
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("const-evaluating `{}`", tcx.def_path_str(key.value.instance.def.def_id())).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
2018-03-09 07:09:24 +01:00
|
|
|
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, _key: Self::Key) -> bool {
|
2018-03-13 16:21:54 +01:00
|
|
|
true
|
2018-03-09 07:09:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2018-06-13 16:44:43 +03:00
|
|
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id).map(Ok)
|
2018-03-09 07:09:24 +01:00
|
|
|
}
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::mir_keys<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"getting a list of all mir_keys".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::symbol_name<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, instance: ty::Instance<'tcx>) -> Cow<'static, str> {
|
|
|
|
format!("computing the symbol for `{}`", instance).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
2017-12-04 20:08:25 +01:00
|
|
|
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, _: Self::Key) -> bool {
|
2017-12-04 20:08:25 +01:00
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2018-06-13 16:44:43 +03:00
|
|
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
2017-12-04 20:08:25 +01:00
|
|
|
}
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::describe_def<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("describe_def")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::def_span<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("def_span")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::lookup_stability<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("stability")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::lookup_deprecation_entry<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("deprecation")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::item_attrs<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("item_attrs")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-22 12:18:16 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_reachable_non_generic<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2018-02-22 12:18:16 +01:00
|
|
|
bug!("is_reachable_non_generic")
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::fn_arg_names<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("fn_arg_names")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::impl_parent<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("impl_parent")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::trait_of_item<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
bug!("trait_of_item")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::const_is_rvalue_promotable_to_static<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
format!("const checking if rvalue is promotable to static `{}`",
|
2018-12-19 12:31:35 +02:00
|
|
|
tcx.def_path_str(def_id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
2017-12-04 20:08:25 +01:00
|
|
|
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, _: Self::Key) -> bool {
|
2017-12-04 20:08:25 +01:00
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
2018-10-01 15:26:53 +02:00
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2018-06-13 16:44:43 +03:00
|
|
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
2017-12-04 20:08:25 +01:00
|
|
|
}
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::rvalue_promotable_map<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2017-09-11 13:09:14 -04:00
|
|
|
format!("checking which parts of `{}` are promotable to static",
|
2018-12-19 12:31:35 +02:00
|
|
|
tcx.def_path_str(def_id)).into()
|
2017-09-11 13:09:14 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_mir_available<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2017-09-18 05:40:13 -04:00
|
|
|
format!("checking if item is mir available: `{}`",
|
2018-12-19 12:31:35 +02:00
|
|
|
tcx.def_path_str(def_id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-08 16:10:16 +03:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::codegen_fulfill_obligation<'tcx> {
|
2018-08-29 22:02:42 -07:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>,
|
2018-10-01 15:31:27 +02:00
|
|
|
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Cow<'static, str> {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("checking if `{}` fulfills its obligations", tcx.def_path_str(key.1.def_id()))
|
2018-10-01 15:31:27 +02:00
|
|
|
.into()
|
2017-09-28 23:13:43 -04:00
|
|
|
}
|
2017-12-04 20:08:25 +01:00
|
|
|
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, _: Self::Key) -> bool {
|
2017-12-04 20:08:25 +01:00
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2018-06-13 16:44:43 +03:00
|
|
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
2017-12-04 20:08:25 +01:00
|
|
|
}
|
2017-09-28 23:13:43 -04:00
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::trait_impls_of<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("trait impls of `{}`", tcx.def_path_str(def_id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_object_safe<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("determine object safety of trait `{}`", tcx.def_path_str(def_id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-31 13:50:14 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_const_fn_raw<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("checking if item is const fn: `{}`", tcx.def_path_str(def_id)).into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::dylib_dependency_formats<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"dylib dependency formats of crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_panic_runtime<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"checking if the crate is_panic_runtime".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_compiler_builtins<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"checking if the crate is_compiler_builtins".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::has_global_allocator<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"checking if the crate has_global_allocator".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-06 21:24:33 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::has_panic_handler<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"checking if the crate has_panic_handler".into()
|
2018-09-06 21:24:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::extern_crate<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
|
|
|
"getting crate's ExternCrateData".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-08 20:30:23 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::analysis<'tcx> {
|
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"running analysis passes on this crate".into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::lint_levels<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"computing the lint levels for items in this crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::specializes<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: (DefId, DefId)) -> Cow<'static, str> {
|
|
|
|
"computing whether impls specialize one another".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::in_scope_traits_map<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> Cow<'static, str> {
|
|
|
|
"traits in scope at a block".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_no_builtins<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"test whether a crate has #![no_builtins]".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::panic_strategy<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"query a crate's configured panic strategy".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_profiler_runtime<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"query a crate is #![profiler_runtime]".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_sanitizer_runtime<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"query a crate is #![sanitizer_runtime]".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-22 12:18:16 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::reachable_non_generics<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the exported symbols of a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::native_libraries<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the native libraries of a linked crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-10 14:28:17 -08:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::foreign_modules<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the foreign modules of a linked crate".into()
|
2018-02-10 14:28:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-13 13:06:26 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::entry_fn<'tcx> {
|
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the entry function of a crate".into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::plugin_registrar_fn<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the plugin registrar for a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-16 01:09:22 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::proc_macro_decls_static<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the derive registrar for a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::crate_disambiguator<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the disambiguator a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::crate_hash<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the hash a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::original_crate_name<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the original name a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-13 11:58:53 -07:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::extra_filename<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the extra filename for a crate".into()
|
2018-03-13 11:58:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::implementations_of_trait<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: (CrateNum, DefId)) -> Cow<'static, str> {
|
|
|
|
"looking up implementations of a trait in a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::all_trait_implementations<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up all (?) trait implementations".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::link_args<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up link arguments for a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-23 08:05:58 -05:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::resolve_lifetimes<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"resolving lifetimes".into()
|
2017-11-23 08:05:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::named_region_map<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> Cow<'static, str> {
|
|
|
|
"looking up a named region".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::is_late_bound_map<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> Cow<'static, str> {
|
|
|
|
"testing if a region is late bound".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::object_lifetime_defaults_map<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> Cow<'static, str> {
|
|
|
|
"looking up lifetime defaults for a region".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::dep_kind<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"fetching what a dependency looks like".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::crate_name<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"fetching what a crate is named".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-23 01:20:33 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::get_lib_features<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"calculating the lib features map".into()
|
2018-07-23 01:20:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::defined_lib_features<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"calculating the lib features defined in a crate".into()
|
2018-07-23 01:20:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::get_lang_items<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"calculating the lang items map".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::defined_lang_items<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"calculating the lang items defined in a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::missing_lang_items<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"calculating the missing lang items in a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::visible_parent_map<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"calculating the visible parent map".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::missing_extern_crate_item<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"seeing if we're missing an `extern crate` item for this crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::used_crate_source<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking at the source for a crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::postorder_cnums<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"generating a postorder list of CrateNums".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::maybe_unused_extern_crates<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up all possibly unused extern crates".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::stability_index<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"calculating the stability index for the local crate".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-01 08:15:25 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::all_traits<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"fetching all foreign and local traits".into()
|
2018-04-01 08:15:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::all_crate_nums<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"fetching all foreign CrateNum instances".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::exported_symbols<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"exported_symbols".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-08 16:10:16 +03:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::collect_and_partition_mono_items<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"collect_and_partition_mono_items".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::codegen_unit<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: InternedString) -> Cow<'static, str> {
|
|
|
|
"codegen_unit".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::output_filenames<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"output_filenames".into()
|
2017-09-18 05:40:13 -04:00
|
|
|
}
|
|
|
|
}
|
2017-09-20 20:42:49 +02:00
|
|
|
|
2017-11-14 17:00:44 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::vtable_methods<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, key: ty::PolyTraitRef<'tcx> ) -> Cow<'static, str> {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("finding all methods for trait {}", tcx.def_path_str(key.def_id())).into()
|
2017-10-07 16:55:09 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-14 16:11:02 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::features_query<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up enabled feature gates".into()
|
2018-02-14 16:11:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 19:52:49 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::typeck_tables_of<'tcx> {
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, def_id: Self::Key) -> bool {
|
2017-11-14 19:52:49 +01:00
|
|
|
def_id.is_local()
|
|
|
|
}
|
|
|
|
|
2017-11-29 12:42:59 +01:00
|
|
|
fn try_load_from_disk(tcx: TyCtxt<'_, 'tcx, 'tcx>,
|
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2017-11-28 17:32:28 +01:00
|
|
|
let typeck_tables: Option<ty::TypeckTables<'tcx>> = tcx
|
2018-06-13 16:44:43 +03:00
|
|
|
.queries.on_disk_cache
|
2017-11-28 17:32:28 +01:00
|
|
|
.try_load_query_result(tcx, id);
|
|
|
|
|
|
|
|
typeck_tables.map(|tables| tcx.alloc_tables(tables))
|
2017-11-14 19:52:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-04 20:08:25 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::optimized_mir<'tcx> {
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, def_id: Self::Key) -> bool {
|
2017-12-04 20:08:25 +01:00
|
|
|
def_id.is_local()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
2018-01-17 16:39:29 +01:00
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2019-02-05 11:20:45 -06:00
|
|
|
let mir: Option<crate::mir::Mir<'tcx>> = tcx.queries.on_disk_cache
|
2017-12-04 20:08:25 +01:00
|
|
|
.try_load_query_result(tcx, id);
|
|
|
|
mir.map(|x| tcx.alloc_mir(x))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-27 12:32:44 -05:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::substitute_normalize_and_test_predicates<'tcx> {
|
2019-02-09 22:11:53 +08:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, key: (DefId, SubstsRef<'tcx>)) -> Cow<'static, str> {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("testing substituted normalized predicates:`{}`", tcx.def_path_str(key.0)).into()
|
2017-12-27 12:32:44 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-02 00:29:06 +02:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::method_autoderef_steps<'tcx> {
|
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> Cow<'static, str> {
|
|
|
|
format!("computing autoderef types for `{:?}`", goal).into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-05 13:26:26 -08:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::target_features_whitelist<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"looking up the whitelist of target features".into()
|
2018-01-05 13:26:26 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-19 00:32:58 +00:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::instance_def_size_estimate<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(tcx: TyCtxt<'_, '_, '_>, def: ty::InstanceDef<'tcx>) -> Cow<'static, str> {
|
2018-12-19 12:31:35 +02:00
|
|
|
format!("estimating size for `{}`", tcx.def_path_str(def.def_id())).into()
|
2018-01-19 00:32:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-17 16:39:29 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::generics_of<'tcx> {
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, def_id: Self::Key) -> bool {
|
2018-01-17 16:39:29 +01:00
|
|
|
def_id.is_local()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2018-06-13 16:44:43 +03:00
|
|
|
let generics: Option<ty::Generics> = tcx.queries.on_disk_cache
|
2018-01-17 16:39:29 +01:00
|
|
|
.try_load_query_result(tcx, id);
|
|
|
|
generics.map(|x| tcx.alloc_generics(x))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-10 12:44:33 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::program_clauses_for<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
|
|
|
"generating chalk-style clauses".into()
|
2018-03-10 12:44:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-10 05:55:18 -04:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::program_clauses_for_env<'tcx> {
|
2018-10-10 17:14:33 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: traits::Environment<'tcx>) -> Cow<'static, str> {
|
|
|
|
"generating chalk-style clauses for environment".into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::environment<'tcx> {
|
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefId) -> Cow<'static, str> {
|
|
|
|
"return a chalk-style environment".into()
|
2018-04-10 05:55:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-10 14:28:17 -08:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::wasm_import_module_map<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"wasm import module map".into()
|
2018-02-10 14:28:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::dllimport_foreign_items<'tcx> {
|
2018-10-01 15:31:27 +02:00
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"wasm import module map".into()
|
2018-02-10 14:28:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-27 15:29:06 +03:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::backend_optimization_level<'tcx> {
|
|
|
|
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
|
|
|
|
"optimization level used by backend".into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-04 20:08:25 +01:00
|
|
|
macro_rules! impl_disk_cacheable_query(
|
2019-01-26 15:58:39 +01:00
|
|
|
($query_name:ident, |$tcx:tt, $key:tt| $cond:expr) => {
|
2017-12-04 20:08:25 +01:00
|
|
|
impl<'tcx> QueryDescription<'tcx> for queries::$query_name<'tcx> {
|
|
|
|
#[inline]
|
2019-01-26 15:58:39 +01:00
|
|
|
fn cache_on_disk($tcx: TyCtxt<'_, 'tcx, 'tcx>, $key: Self::Key) -> bool {
|
2017-12-04 20:08:25 +01:00
|
|
|
$cond
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
id: SerializedDepNodeIndex)
|
|
|
|
-> Option<Self::Value> {
|
2018-06-13 16:44:43 +03:00
|
|
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
2017-12-04 20:08:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2019-01-26 15:58:39 +01:00
|
|
|
impl_disk_cacheable_query!(mir_borrowck, |tcx, def_id| {
|
|
|
|
def_id.is_local() && tcx.is_closure(def_id)
|
|
|
|
});
|
|
|
|
|
|
|
|
impl_disk_cacheable_query!(unsafety_check_result, |_, def_id| def_id.is_local());
|
|
|
|
impl_disk_cacheable_query!(borrowck, |_, def_id| def_id.is_local());
|
|
|
|
impl_disk_cacheable_query!(mir_const_qualif, |_, def_id| def_id.is_local());
|
|
|
|
impl_disk_cacheable_query!(check_match, |_, def_id| def_id.is_local());
|
|
|
|
impl_disk_cacheable_query!(def_symbol_name, |_, _| true);
|
|
|
|
impl_disk_cacheable_query!(type_of, |_, def_id| def_id.is_local());
|
|
|
|
impl_disk_cacheable_query!(predicates_of, |_, def_id| def_id.is_local());
|
|
|
|
impl_disk_cacheable_query!(used_trait_imports, |_, def_id| def_id.is_local());
|
|
|
|
impl_disk_cacheable_query!(codegen_fn_attrs, |_, _| true);
|
|
|
|
impl_disk_cacheable_query!(specialization_graph_of, |_, _| true);
|