Drop has_params.
This commit is contained in:
parent
aa404c24dd
commit
dc7143367c
4 changed files with 4 additions and 40 deletions
|
@ -75,9 +75,6 @@ pub use rustc_query_system::dep_graph::{DepContext, DepNodeParams};
|
||||||
/// of the `DepKind`. Overall, this allows to implement `DepContext` using this manual
|
/// of the `DepKind`. Overall, this allows to implement `DepContext` using this manual
|
||||||
/// jump table instead of large matches.
|
/// jump table instead of large matches.
|
||||||
pub struct DepKindStruct {
|
pub struct DepKindStruct {
|
||||||
/// Whether the DepNode has parameters (query keys).
|
|
||||||
pub(super) has_params: bool,
|
|
||||||
|
|
||||||
/// Anonymous queries cannot be replayed from one compiler invocation to the next.
|
/// Anonymous queries cannot be replayed from one compiler invocation to the next.
|
||||||
/// When their result is needed, it is recomputed. They are useful for fine-grained
|
/// When their result is needed, it is recomputed. They are useful for fine-grained
|
||||||
/// dependency tracking, and caching within one compiler invocation.
|
/// dependency tracking, and caching within one compiler invocation.
|
||||||
|
@ -115,13 +112,6 @@ impl DepKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// erase!() just makes tokens go away. It's used to specify which macro argument
|
|
||||||
// is repeated (i.e., which sub-expression of the macro we are in) but don't need
|
|
||||||
// to actually use any of the arguments.
|
|
||||||
macro_rules! erase {
|
|
||||||
($x:tt) => {{}};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! is_anon_attr {
|
macro_rules! is_anon_attr {
|
||||||
(anon) => {
|
(anon) => {
|
||||||
true
|
true
|
||||||
|
@ -156,7 +146,6 @@ pub mod dep_kind {
|
||||||
|
|
||||||
// We use this for most things when incr. comp. is turned off.
|
// We use this for most things when incr. comp. is turned off.
|
||||||
pub const Null: DepKindStruct = DepKindStruct {
|
pub const Null: DepKindStruct = DepKindStruct {
|
||||||
has_params: false,
|
|
||||||
is_anon: false,
|
is_anon: false,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
|
|
||||||
|
@ -164,7 +153,6 @@ pub mod dep_kind {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const TraitSelect: DepKindStruct = DepKindStruct {
|
pub const TraitSelect: DepKindStruct = DepKindStruct {
|
||||||
has_params: false,
|
|
||||||
is_anon: true,
|
is_anon: true,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
|
|
||||||
|
@ -172,7 +160,6 @@ pub mod dep_kind {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CompileCodegenUnit: DepKindStruct = DepKindStruct {
|
pub const CompileCodegenUnit: DepKindStruct = DepKindStruct {
|
||||||
has_params: true,
|
|
||||||
is_anon: false,
|
is_anon: false,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
|
|
||||||
|
@ -180,7 +167,6 @@ pub mod dep_kind {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CompileMonoItem: DepKindStruct = DepKindStruct {
|
pub const CompileMonoItem: DepKindStruct = DepKindStruct {
|
||||||
has_params: true,
|
|
||||||
is_anon: false,
|
is_anon: false,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
|
|
||||||
|
@ -193,7 +179,6 @@ pub mod dep_kind {
|
||||||
$variant:ident $(( $tuple_arg_ty:ty $(,)? ))*
|
$variant:ident $(( $tuple_arg_ty:ty $(,)? ))*
|
||||||
,)*) => (
|
,)*) => (
|
||||||
$(pub const $variant: DepKindStruct = {
|
$(pub const $variant: DepKindStruct = {
|
||||||
const has_params: bool = $({ erase!($tuple_arg_ty); true } |)* false;
|
|
||||||
const is_anon: bool = contains_anon_attr!($($attrs)*);
|
const is_anon: bool = contains_anon_attr!($($attrs)*);
|
||||||
const is_eval_always: bool = contains_eval_always_attr!($($attrs)*);
|
const is_eval_always: bool = contains_eval_always_attr!($($attrs)*);
|
||||||
|
|
||||||
|
@ -204,7 +189,6 @@ pub mod dep_kind {
|
||||||
}
|
}
|
||||||
|
|
||||||
DepKindStruct {
|
DepKindStruct {
|
||||||
has_params,
|
|
||||||
is_anon,
|
is_anon,
|
||||||
is_eval_always,
|
is_eval_always,
|
||||||
fingerprint_style,
|
fingerprint_style,
|
||||||
|
@ -350,13 +334,7 @@ impl DepNodeExt for DepNode {
|
||||||
|
|
||||||
match kind.fingerprint_style() {
|
match kind.fingerprint_style() {
|
||||||
FingerprintStyle::Opaque => Err(()),
|
FingerprintStyle::Opaque => Err(()),
|
||||||
FingerprintStyle::Unit => {
|
FingerprintStyle::Unit => Ok(DepNode::new_no_params(kind)),
|
||||||
if !kind.has_params {
|
|
||||||
Ok(DepNode::new_no_params(kind))
|
|
||||||
} else {
|
|
||||||
Err(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FingerprintStyle::DefPathHash => Ok(DepNode::from_def_path_hash(def_path_hash, kind)),
|
FingerprintStyle::DefPathHash => Ok(DepNode::from_def_path_hash(def_path_hash, kind)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,19 +34,8 @@ impl rustc_query_system::dep_graph::DepKind for DepKind {
|
||||||
self.is_eval_always
|
self.is_eval_always
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
fn has_params(&self) -> bool {
|
|
||||||
self.has_params
|
|
||||||
}
|
|
||||||
|
|
||||||
fn debug_node(node: &DepNode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn debug_node(node: &DepNode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{:?}", node.kind)?;
|
write!(f, "{:?}(", node.kind)?;
|
||||||
|
|
||||||
if !node.kind.has_params && !node.kind.is_anon {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
write!(f, "(")?;
|
|
||||||
|
|
||||||
ty::tls::with_opt(|opt_tcx| {
|
ty::tls::with_opt(|opt_tcx| {
|
||||||
if let Some(tcx) = opt_tcx {
|
if let Some(tcx) = opt_tcx {
|
||||||
|
|
|
@ -61,7 +61,7 @@ impl<K: DepKind> DepNode<K> {
|
||||||
/// that the DepNode corresponding to the given DepKind actually
|
/// that the DepNode corresponding to the given DepKind actually
|
||||||
/// does not require any parameters.
|
/// does not require any parameters.
|
||||||
pub fn new_no_params(kind: K) -> DepNode<K> {
|
pub fn new_no_params(kind: K) -> DepNode<K> {
|
||||||
debug_assert!(!kind.has_params());
|
debug_assert_eq!(kind.fingerprint_style(), FingerprintStyle::Unit);
|
||||||
DepNode { kind, hash: Fingerprint::ZERO.into() }
|
DepNode { kind, hash: Fingerprint::ZERO.into() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl<T: DepContext> HasDepContext for T {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describes the contents of the fingerprint generated by a given query.
|
/// Describes the contents of the fingerprint generated by a given query.
|
||||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
pub enum FingerprintStyle {
|
pub enum FingerprintStyle {
|
||||||
/// The fingerprint is actually a DefPathHash.
|
/// The fingerprint is actually a DefPathHash.
|
||||||
DefPathHash,
|
DefPathHash,
|
||||||
|
@ -78,9 +78,6 @@ pub trait DepKind: Copy + fmt::Debug + Eq + Hash + Send + Encodable<FileEncoder>
|
||||||
/// Return whether this kind always require evaluation.
|
/// Return whether this kind always require evaluation.
|
||||||
fn is_eval_always(&self) -> bool;
|
fn is_eval_always(&self) -> bool;
|
||||||
|
|
||||||
/// Return whether this kind requires additional parameters to be executed.
|
|
||||||
fn has_params(&self) -> bool;
|
|
||||||
|
|
||||||
/// Implementation of `std::fmt::Debug` for `DepNode`.
|
/// Implementation of `std::fmt::Debug` for `DepNode`.
|
||||||
fn debug_node(node: &DepNode<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result;
|
fn debug_node(node: &DepNode<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue