impl rustc_query_system::dep_graph::DepKind for DepKind {
const NULL: Self = DepKind::Null;
+ const RED: Self = DepKind::Red;
fn debug_node(node: &DepNode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}(", node.kind)?;
}
}
+ // We use this for the forever-red node.
+ pub fn Red() -> DepKindStruct {
+ DepKindStruct {
+ is_anon: false,
+ is_eval_always: false,
+ fingerprint_style: FingerprintStyle::Unit,
+ force_from_dep_node: Some(|_, dep_node| bug!("force_from_dep_node: encountered {:?}", dep_node)),
+ try_load_from_on_disk_cache: None,
+ }
+ }
+
pub fn TraitSelect() -> DepKindStruct {
DepKindStruct {
is_anon: true,
smallvec![],
Fingerprint::ZERO,
);
- debug_assert_eq!(_green_node_index, DepNodeIndex::SINGLETON_DEPENDENCYLESS_ANON_NODE);
+ assert_eq!(_green_node_index, DepNodeIndex::SINGLETON_DEPENDENCYLESS_ANON_NODE);
// Instantiate a dependy-less red node only once for anonymous queries.
let (_red_node_index, _prev_and_index) = current.intern_node(
profiler,
&prev_graph,
- DepNode { kind: DepKind::NULL, hash: Fingerprint::ZERO.into() },
+ DepNode { kind: DepKind::RED, hash: Fingerprint::ZERO.into() },
smallvec![],
None,
false,
);
- debug_assert_eq!(_red_node_index, DepNodeIndex::FOREVER_RED_NODE);
- debug_assert!(matches!(_prev_and_index, None | Some((_, DepNodeColor::Red))));
+ assert_eq!(_red_node_index, DepNodeIndex::FOREVER_RED_NODE);
+ assert!(matches!(_prev_and_index, None | Some((_, DepNodeColor::Red))));
DepGraph {
data: Some(Lrc::new(DepGraphData {
let mut stable_hasher = StableHasher::new();
nanos.hash(&mut stable_hasher);
let anon_id_seed = stable_hasher.finish();
- // We rely on the fact that `anon_id_seed` is not zero when creating static nodes.
- debug_assert_ne!(anon_id_seed, Fingerprint::ZERO);
#[cfg(debug_assertions)]
let forbidden_edge = match env::var("RUST_FORBID_DEP_GRAPH_EDGE") {
/// Describe the different families of dependency nodes.
pub trait DepKind: Copy + fmt::Debug + Eq + Hash + Send + Encodable<FileEncoder> + 'static {
+ /// DepKind to use when incr. comp. is turned off.
const NULL: Self;
+ /// DepKind to use to create the initial forever-red node.
+ const RED: Self;
+
/// Implementation of `std::fmt::Debug` for `DepNode`.
fn debug_node(node: &DepNode<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result;