1
Fork 0

Pass in dep kind names to the duplicate dep node check

This commit is contained in:
John Kåre Alsaker 2025-03-18 22:26:44 +01:00
parent f5dc674bf8
commit 68fd771bc1
7 changed files with 38 additions and 10 deletions

View file

@ -100,6 +100,8 @@ pub trait Deps {
where
OP: for<'a> FnOnce(TaskDepsRef<'a>);
fn name(&self, dep_kind: DepKind) -> &'static str;
/// We use this for most things when incr. comp. is turned off.
const DEP_KIND_NULL: DepKind;
@ -154,7 +156,7 @@ pub enum FingerprintStyle {
impl FingerprintStyle {
#[inline]
pub fn reconstructible(self) -> bool {
pub const fn reconstructible(self) -> bool {
match self {
FingerprintStyle::DefPathHash | FingerprintStyle::Unit | FingerprintStyle::HirId => {
true

View file

@ -179,8 +179,8 @@ fn mask(bits: usize) -> usize {
}
impl SerializedDepGraph {
#[instrument(level = "debug", skip(d))]
pub fn decode<D: Deps>(d: &mut MemDecoder<'_>) -> Arc<SerializedDepGraph> {
#[instrument(level = "debug", skip(d, deps))]
pub fn decode<D: Deps>(d: &mut MemDecoder<'_>, deps: &D) -> Arc<SerializedDepGraph> {
// The last 16 bytes are the node count and edge count.
debug!("position: {:?}", d.position());
let (node_count, edge_count) =
@ -253,8 +253,9 @@ impl SerializedDepGraph {
for (idx, node) in nodes.iter_enumerated() {
if index[node.kind.as_usize()].insert(node.hash, idx).is_some() {
let name = deps.name(node.kind);
panic!(
"Error: A dep graph node does not have an unique index. \
"Error: A dep graph node ({name}) does not have an unique index. \
Running a clean build on a nightly compiler with `-Z incremental-verify-ich` \
can help narrow down the issue for reporting. A clean build may also work around the issue.\n
DepNode: {node:?}"