diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs index 2f637dfe0cbd..1ffbdfbf1187 100644 --- a/compiler/rustc_middle/src/dep_graph/dep_node.rs +++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs @@ -83,10 +83,6 @@ pub const fn as_usize(&self) -> usize { *self as usize } - pub(crate) fn name(self) -> &'static str { - DEP_KIND_NAMES[self.as_usize()] - } - /// This is the highest value a `DepKind` can have. It's used during encoding to /// pack information into the unused bits. pub(crate) const MAX: u16 = DEP_KIND_NUM_VARIANTS - 1; @@ -287,9 +283,6 @@ pub struct DepKindVTable<'tcx> { /// Invoke a query to put the on-disk cached value in memory. pub try_load_from_on_disk_cache: Option, DepNode)>, - - /// The name of this dep kind. - pub name: &'static &'static str, } /// A "work product" corresponds to a `.o` (or other) file that we @@ -372,12 +365,6 @@ pub enum DepKind { deps.len() as u16 }; - /// List containing the name of each dep kind as a static string, - /// indexable by `DepKind`. - pub(crate) const DEP_KIND_NAMES: &[&str] = &[ - $( self::label_strs::$variant, )* - ]; - pub(super) fn dep_kind_from_label_string(label: &str) -> Result { match label { $( stringify!($variant) => Ok(self::DepKind::$variant), )* diff --git a/compiler/rustc_middle/src/dep_graph/serialized.rs b/compiler/rustc_middle/src/dep_graph/serialized.rs index a22af8a296dd..7885b4353544 100644 --- a/compiler/rustc_middle/src/dep_graph/serialized.rs +++ b/compiler/rustc_middle/src/dep_graph/serialized.rs @@ -288,13 +288,14 @@ pub fn decode(d: &mut MemDecoder<'_>) -> Arc { if index[node.kind.as_usize()].insert(node.key_fingerprint, idx).is_some() { // Empty nodes and side effect nodes can have duplicates if node.kind != DepKind::Null && node.kind != DepKind::SideEffect { - let name = node.kind.name(); + let kind = 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:?}" - ) + "Error: A dep graph node ({kind:?}) 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:?}" + ) } } } diff --git a/compiler/rustc_query_impl/src/dep_kind_vtables.rs b/compiler/rustc_query_impl/src/dep_kind_vtables.rs index 39bd2569ef46..a180ea8327fd 100644 --- a/compiler/rustc_query_impl/src/dep_kind_vtables.rs +++ b/compiler/rustc_query_impl/src/dep_kind_vtables.rs @@ -20,7 +20,6 @@ pub(crate) fn Null<'tcx>() -> DepKindVTable<'tcx> { bug!("force_from_dep_node: encountered {dep_node:?}") }), try_load_from_on_disk_cache: None, - name: &"Null", } } @@ -34,7 +33,6 @@ pub(crate) fn Red<'tcx>() -> DepKindVTable<'tcx> { bug!("force_from_dep_node: encountered {dep_node:?}") }), try_load_from_on_disk_cache: None, - name: &"Red", } } @@ -48,7 +46,6 @@ pub(crate) fn SideEffect<'tcx>() -> DepKindVTable<'tcx> { true }), try_load_from_on_disk_cache: None, - name: &"SideEffect", } } @@ -59,7 +56,6 @@ pub(crate) fn AnonZeroDeps<'tcx>() -> DepKindVTable<'tcx> { key_fingerprint_style: KeyFingerprintStyle::Opaque, force_from_dep_node: Some(|_, _, _| bug!("cannot force an anon node")), try_load_from_on_disk_cache: None, - name: &"AnonZeroDeps", } } @@ -70,7 +66,6 @@ pub(crate) fn TraitSelect<'tcx>() -> DepKindVTable<'tcx> { key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: None, try_load_from_on_disk_cache: None, - name: &"TraitSelect", } } @@ -81,7 +76,6 @@ pub(crate) fn CompileCodegenUnit<'tcx>() -> DepKindVTable<'tcx> { key_fingerprint_style: KeyFingerprintStyle::Opaque, force_from_dep_node: None, try_load_from_on_disk_cache: None, - name: &"CompileCodegenUnit", } } @@ -92,7 +86,6 @@ pub(crate) fn CompileMonoItem<'tcx>() -> DepKindVTable<'tcx> { key_fingerprint_style: KeyFingerprintStyle::Opaque, force_from_dep_node: None, try_load_from_on_disk_cache: None, - name: &"CompileMonoItem", } } @@ -103,7 +96,6 @@ pub(crate) fn Metadata<'tcx>() -> DepKindVTable<'tcx> { key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: None, try_load_from_on_disk_cache: None, - name: &"Metadata", } } } @@ -131,7 +123,6 @@ pub(crate) fn make_dep_kind_vtable_for_query<'tcx, Q, Cache, const FLAGS: QueryF key_fingerprint_style, force_from_dep_node: None, try_load_from_on_disk_cache: None, - name: Q::NAME, }; } @@ -145,7 +136,6 @@ pub(crate) fn make_dep_kind_vtable_for_query<'tcx, Q, Cache, const FLAGS: QueryF try_load_from_on_disk_cache: Some(|tcx, dep_node| { try_load_from_on_disk_cache_inner(Q::query_dispatcher(tcx), tcx, dep_node) }), - name: Q::NAME, } } diff --git a/compiler/rustc_query_impl/src/job.rs b/compiler/rustc_query_impl/src/job.rs index 1256b514edb5..5f728fec83c3 100644 --- a/compiler/rustc_query_impl/src/job.rs +++ b/compiler/rustc_query_impl/src/job.rs @@ -423,10 +423,8 @@ pub fn print_query_stack<'tcx>( if let Some(ref mut file) = file { let _ = writeln!( file, - "#{} [{}] {}", - count_total, - tcx.dep_kind_vtable(query_info.frame.dep_kind).name, - query_extra.description + "#{} [{:?}] {}", + count_total, query_info.frame.dep_kind, query_extra.description ); } diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index b4a64686728f..2804f5cfa055 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -231,8 +231,6 @@ fn construct_dep_node(self, tcx: TyCtxt<'tcx>, key: &C::Key) -> DepNode { trait QueryDispatcherUnerased<'tcx, C: QueryCache, const FLAGS: QueryFlags> { type UnerasedValue; - const NAME: &'static &'static str; - fn query_dispatcher(tcx: TyCtxt<'tcx>) -> SemiDynamicQueryDispatcher<'tcx, C, FLAGS>; fn restore_val(value: C::Value) -> Self::UnerasedValue; diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 31f27efdb43f..1ed601aae356 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -630,8 +630,6 @@ impl<'tcx> QueryDispatcherUnerased<'tcx, queries::$name::Storage<'tcx>, FLAGS> { type UnerasedValue = queries::$name::Value<'tcx>; - const NAME: &'static &'static str = &stringify!($name); - #[inline(always)] fn query_dispatcher(tcx: TyCtxt<'tcx>) -> SemiDynamicQueryDispatcher<'tcx, queries::$name::Storage<'tcx>, FLAGS>