提交 222d0102 编写于 作者: C Camille GILLOT

Cleanups.

上级 db5be1fe
...@@ -95,6 +95,10 @@ fn create_stable_hashing_context(&self) -> Self::StableHashingContext { ...@@ -95,6 +95,10 @@ fn create_stable_hashing_context(&self) -> Self::StableHashingContext {
TyCtxt::create_stable_hashing_context(*self) TyCtxt::create_stable_hashing_context(*self)
} }
fn debug_dep_tasks(&self) -> bool {
self.sess.opts.debugging_opts.dep_tasks
}
fn try_force_from_dep_node(&self, dep_node: &DepNode) -> bool { fn try_force_from_dep_node(&self, dep_node: &DepNode) -> bool {
// FIXME: This match is just a workaround for incremental bugs and should // FIXME: This match is just a workaround for incremental bugs and should
// be removed. https://github.com/rust-lang/rust/issues/62649 is one such // be removed. https://github.com/rust-lang/rust/issues/62649 is one such
...@@ -181,8 +185,4 @@ fn def_id_corresponds_to_hir_dep_node(tcx: TyCtxt<'_>, def_id: DefId) -> bool { ...@@ -181,8 +185,4 @@ fn def_id_corresponds_to_hir_dep_node(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
def_id.index == hir_id.owner.local_def_index def_id.index == hir_id.owner.local_def_index
} }
impl rustc_query_system::HashStableContext for StableHashingContext<'_> { impl rustc_query_system::HashStableContext for StableHashingContext<'_> {}
fn debug_dep_tasks(&self) -> bool {
self.sess().opts.debugging_opts.dep_tasks
}
}
...@@ -209,14 +209,14 @@ pub fn try_print_query_stack(handler: &Handler) { ...@@ -209,14 +209,14 @@ pub fn try_print_query_stack(handler: &Handler) {
} }
macro_rules! query_storage { macro_rules! query_storage {
(<$tcx:tt>[][$K:ty, $V:ty]) => { ([][$K:ty, $V:ty]) => {
<<$K as Key>::CacheSelector as CacheSelector<$K, $V>>::Cache <<$K as Key>::CacheSelector as CacheSelector<$K, $V>>::Cache
}; };
(<$tcx:tt>[storage($ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => { ([storage($ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => {
$ty $ty
}; };
(<$tcx:tt>[$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => { ([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
query_storage!(<$tcx>[$($($modifiers)*)*][$($args)*]) query_storage!([$($($modifiers)*)*][$($args)*])
}; };
} }
...@@ -332,7 +332,7 @@ impl<$tcx> QueryAccessors<TyCtxt<$tcx>> for queries::$name<$tcx> { ...@@ -332,7 +332,7 @@ impl<$tcx> QueryAccessors<TyCtxt<$tcx>> for queries::$name<$tcx> {
const EVAL_ALWAYS: bool = is_eval_always!([$($modifiers)*]); const EVAL_ALWAYS: bool = is_eval_always!([$($modifiers)*]);
const DEP_KIND: dep_graph::DepKind = dep_graph::DepKind::$node; const DEP_KIND: dep_graph::DepKind = dep_graph::DepKind::$node;
type Cache = query_storage!(<$tcx>[$($modifiers)*][$K, $V]); type Cache = query_storage!([$($modifiers)*][$K, $V]);
#[inline(always)] #[inline(always)]
fn query_state<'a>(tcx: TyCtxt<$tcx>) -> &'a QueryState<TyCtxt<$tcx>, Self::Cache> { fn query_state<'a>(tcx: TyCtxt<$tcx>) -> &'a QueryState<TyCtxt<$tcx>, Self::Cache> {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
use super::query::DepGraphQuery; use super::query::DepGraphQuery;
use super::serialized::{SerializedDepGraph, SerializedDepNodeIndex}; use super::serialized::{SerializedDepGraph, SerializedDepNodeIndex};
use super::{DepContext, DepKind, DepNode, WorkProductId}; use super::{DepContext, DepKind, DepNode, WorkProductId};
use crate::HashStableContext;
#[derive(Clone)] #[derive(Clone)]
pub struct DepGraph<K: DepKind> { pub struct DepGraph<K: DepKind> {
...@@ -259,7 +258,7 @@ fn with_task_impl<Ctxt: DepContext<DepKind = K>, A, R>( ...@@ -259,7 +258,7 @@ fn with_task_impl<Ctxt: DepContext<DepKind = K>, A, R>(
task_deps.map(|lock| lock.into_inner()), task_deps.map(|lock| lock.into_inner()),
); );
let print_status = cfg!(debug_assertions) && hcx.debug_dep_tasks(); let print_status = cfg!(debug_assertions) && cx.debug_dep_tasks();
// Determine the color of the new DepNode. // Determine the color of the new DepNode.
if let Some(prev_index) = data.previous.node_to_index_opt(&key) { if let Some(prev_index) = data.previous.node_to_index_opt(&key) {
......
...@@ -27,6 +27,8 @@ pub trait DepContext: Copy { ...@@ -27,6 +27,8 @@ pub trait DepContext: Copy {
/// Create a hashing context for hashing new results. /// Create a hashing context for hashing new results.
fn create_stable_hashing_context(&self) -> Self::StableHashingContext; fn create_stable_hashing_context(&self) -> Self::StableHashingContext;
fn debug_dep_tasks(&self) -> bool;
/// Try to force a dep node to execute and see if it's green. /// Try to force a dep node to execute and see if it's green.
fn try_force_from_dep_node(&self, dep_node: &DepNode<Self::DepKind>) -> bool; fn try_force_from_dep_node(&self, dep_node: &DepNode<Self::DepKind>) -> bool;
......
...@@ -16,6 +16,4 @@ ...@@ -16,6 +16,4 @@
pub mod dep_graph; pub mod dep_graph;
pub mod query; pub mod query;
pub trait HashStableContext { pub trait HashStableContext {}
fn debug_dep_tasks(&self) -> bool;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册