about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-24 15:02:09 +0000
committerbors <bors@rust-lang.org>2025-03-24 15:02:09 +0000
commit4510e86a41388733675465a8647d4235f3bf2023 (patch)
treec851d1e39a4cdf96f7ed110856055084a8b27926 /compiler/rustc_middle/src
parent90f5eab952728ac6edcf529a171f7de5c25e5d49 (diff)
parent2736a2a84f972baabe4012f890aaae14489af8d9 (diff)
downloadrust-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_middle/src')
-rw-r--r--compiler/rustc_middle/src/dep_graph/dep_node.rs9
-rw-r--r--compiler/rustc_middle/src/dep_graph/mod.rs8
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs
index f967d8b92c7..be34c7ef4bd 100644
--- a/compiler/rustc_middle/src/dep_graph/dep_node.rs
+++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs
@@ -21,6 +21,15 @@ macro_rules! define_dep_nodes {
             ($mod:ident) => {[ $($mod::$variant()),* ]};
         }
 
+        #[macro_export]
+        macro_rules! make_dep_kind_name_array {
+            ($mod:ident) => {
+                vec! {
+                    $(*$mod::$variant().name),*
+                }
+            };
+        }
+
         /// This enum serves as an index into arrays built by `make_dep_kind_array`.
         // This enum has more than u8::MAX variants so we need some kind of multi-byte
         // encoding. The derived Encodable/Decodable uses leb128 encoding which is
diff --git a/compiler/rustc_middle/src/dep_graph/mod.rs b/compiler/rustc_middle/src/dep_graph/mod.rs
index c927538b4cf..739c0be1a91 100644
--- a/compiler/rustc_middle/src/dep_graph/mod.rs
+++ b/compiler/rustc_middle/src/dep_graph/mod.rs
@@ -20,7 +20,9 @@ pub type DepGraph = rustc_query_system::dep_graph::DepGraph<DepsType>;
 pub type DepKindStruct<'tcx> = rustc_query_system::dep_graph::DepKindStruct<TyCtxt<'tcx>>;
 
 #[derive(Clone)]
-pub struct DepsType;
+pub struct DepsType {
+    pub dep_names: Vec<&'static str>,
+}
 
 impl Deps for DepsType {
     fn with_deps<OP, R>(task_deps: TaskDepsRef<'_>, op: OP) -> R
@@ -44,6 +46,10 @@ impl Deps for DepsType {
         })
     }
 
+    fn name(&self, dep_kind: DepKind) -> &'static str {
+        self.dep_names[dep_kind.as_usize()]
+    }
+
     const DEP_KIND_NULL: DepKind = dep_kinds::Null;
     const DEP_KIND_RED: DepKind = dep_kinds::Red;
     const DEP_KIND_SIDE_EFFECT: DepKind = dep_kinds::SideEffect;