diff options
| author | bors <bors@rust-lang.org> | 2025-03-24 15:02:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-03-24 15:02:09 +0000 |
| commit | 4510e86a41388733675465a8647d4235f3bf2023 (patch) | |
| tree | c851d1e39a4cdf96f7ed110856055084a8b27926 /compiler/rustc_query_system/src/dep_graph/serialized.rs | |
| parent | 90f5eab952728ac6edcf529a171f7de5c25e5d49 (diff) | |
| parent | 2736a2a84f972baabe4012f890aaae14489af8d9 (diff) | |
| download | rust-4510e86a41388733675465a8647d4235f3bf2023.tar.gz rust-4510e86a41388733675465a8647d4235f3bf2023.zip | |
Auto merge of #138629 - Zoxc:graph-anon-hashmap, r=oli-obk
Only use the new node hashmap for anonymous nodes This is a rebase of https://github.com/rust-lang/rust/pull/112469. cc `@cjgillot`
Diffstat (limited to 'compiler/rustc_query_system/src/dep_graph/serialized.rs')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/serialized.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 2c6fd7d494f..f4b2cf631ed 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -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) = @@ -252,7 +252,18 @@ impl SerializedDepGraph { .collect(); for (idx, node) in nodes.iter_enumerated() { - index[node.kind.as_usize()].insert(node.hash, idx); + if index[node.kind.as_usize()].insert(node.hash, idx).is_some() { + // Side effect nodes can have duplicates + if node.kind != D::DEP_KIND_SIDE_EFFECT { + let name = deps.name(node.kind); + panic!( + "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:?}" + ) + } + } } Arc::new(SerializedDepGraph { |
