Skip to content

Commit dc71433

Browse files
committed
Drop has_params.
1 parent aa404c2 commit dc71433

File tree

4 files changed

+4
-40
lines changed

4 files changed

+4
-40
lines changed

compiler/rustc_middle/src/dep_graph/dep_node.rs

+1-23
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ pub use rustc_query_system::dep_graph::{DepContext, DepNodeParams};
7575
/// of the `DepKind`. Overall, this allows to implement `DepContext` using this manual
7676
/// jump table instead of large matches.
7777
pub struct DepKindStruct {
78-
/// Whether the DepNode has parameters (query keys).
79-
pub(super) has_params: bool,
80-
8178
/// Anonymous queries cannot be replayed from one compiler invocation to the next.
8279
/// When their result is needed, it is recomputed. They are useful for fine-grained
8380
/// dependency tracking, and caching within one compiler invocation.
@@ -115,13 +112,6 @@ impl DepKind {
115112
}
116113
}
117114

118-
// erase!() just makes tokens go away. It's used to specify which macro argument
119-
// is repeated (i.e., which sub-expression of the macro we are in) but don't need
120-
// to actually use any of the arguments.
121-
macro_rules! erase {
122-
($x:tt) => {{}};
123-
}
124-
125115
macro_rules! is_anon_attr {
126116
(anon) => {
127117
true
@@ -156,31 +146,27 @@ pub mod dep_kind {
156146

157147
// We use this for most things when incr. comp. is turned off.
158148
pub const Null: DepKindStruct = DepKindStruct {
159-
has_params: false,
160149
is_anon: false,
161150
is_eval_always: false,
162151

163152
fingerprint_style: || FingerprintStyle::Unit,
164153
};
165154

166155
pub const TraitSelect: DepKindStruct = DepKindStruct {
167-
has_params: false,
168156
is_anon: true,
169157
is_eval_always: false,
170158

171159
fingerprint_style: || FingerprintStyle::Unit,
172160
};
173161

174162
pub const CompileCodegenUnit: DepKindStruct = DepKindStruct {
175-
has_params: true,
176163
is_anon: false,
177164
is_eval_always: false,
178165

179166
fingerprint_style: || FingerprintStyle::Opaque,
180167
};
181168

182169
pub const CompileMonoItem: DepKindStruct = DepKindStruct {
183-
has_params: true,
184170
is_anon: false,
185171
is_eval_always: false,
186172

@@ -193,7 +179,6 @@ pub mod dep_kind {
193179
$variant:ident $(( $tuple_arg_ty:ty $(,)? ))*
194180
,)*) => (
195181
$(pub const $variant: DepKindStruct = {
196-
const has_params: bool = $({ erase!($tuple_arg_ty); true } |)* false;
197182
const is_anon: bool = contains_anon_attr!($($attrs)*);
198183
const is_eval_always: bool = contains_eval_always_attr!($($attrs)*);
199184

@@ -204,7 +189,6 @@ pub mod dep_kind {
204189
}
205190

206191
DepKindStruct {
207-
has_params,
208192
is_anon,
209193
is_eval_always,
210194
fingerprint_style,
@@ -350,13 +334,7 @@ impl DepNodeExt for DepNode {
350334

351335
match kind.fingerprint_style() {
352336
FingerprintStyle::Opaque => Err(()),
353-
FingerprintStyle::Unit => {
354-
if !kind.has_params {
355-
Ok(DepNode::new_no_params(kind))
356-
} else {
357-
Err(())
358-
}
359-
}
337+
FingerprintStyle::Unit => Ok(DepNode::new_no_params(kind)),
360338
FingerprintStyle::DefPathHash => Ok(DepNode::from_def_path_hash(def_path_hash, kind)),
361339
}
362340
}

compiler/rustc_middle/src/dep_graph/mod.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,8 @@ impl rustc_query_system::dep_graph::DepKind for DepKind {
3434
self.is_eval_always
3535
}
3636

37-
#[inline(always)]
38-
fn has_params(&self) -> bool {
39-
self.has_params
40-
}
41-
4237
fn debug_node(node: &DepNode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43-
write!(f, "{:?}", node.kind)?;
44-
45-
if !node.kind.has_params && !node.kind.is_anon {
46-
return Ok(());
47-
}
48-
49-
write!(f, "(")?;
38+
write!(f, "{:?}(", node.kind)?;
5039

5140
ty::tls::with_opt(|opt_tcx| {
5241
if let Some(tcx) = opt_tcx {

compiler/rustc_query_system/src/dep_graph/dep_node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<K: DepKind> DepNode<K> {
6161
/// that the DepNode corresponding to the given DepKind actually
6262
/// does not require any parameters.
6363
pub fn new_no_params(kind: K) -> DepNode<K> {
64-
debug_assert!(!kind.has_params());
64+
debug_assert_eq!(kind.fingerprint_style(), FingerprintStyle::Unit);
6565
DepNode { kind, hash: Fingerprint::ZERO.into() }
6666
}
6767

compiler/rustc_query_system/src/dep_graph/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<T: DepContext> HasDepContext for T {
5151
}
5252

5353
/// Describes the contents of the fingerprint generated by a given query.
54-
#[derive(PartialEq, Eq, Copy, Clone)]
54+
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
5555
pub enum FingerprintStyle {
5656
/// The fingerprint is actually a DefPathHash.
5757
DefPathHash,
@@ -78,9 +78,6 @@ pub trait DepKind: Copy + fmt::Debug + Eq + Hash + Send + Encodable<FileEncoder>
7878
/// Return whether this kind always require evaluation.
7979
fn is_eval_always(&self) -> bool;
8080

81-
/// Return whether this kind requires additional parameters to be executed.
82-
fn has_params(&self) -> bool;
83-
8481
/// Implementation of `std::fmt::Debug` for `DepNode`.
8582
fn debug_node(node: &DepNode<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result;
8683

0 commit comments

Comments
 (0)