@@ -12,7 +12,7 @@ use rustc_hir::limit::Limit;
1212use rustc_index:: Idx ;
1313use rustc_middle:: bug;
1414use rustc_middle:: dep_graph:: {
15- self , DepContext , DepKind , DepKindStruct , DepNode , DepNodeIndex , SerializedDepNodeIndex ,
15+ self , DepContext , DepKind , DepKindVTable , DepNode , DepNodeIndex , SerializedDepNodeIndex ,
1616 dep_kinds,
1717} ;
1818use rustc_middle:: query:: Key ;
@@ -489,14 +489,17 @@ where
489489 }
490490}
491491
492- pub ( crate ) fn query_callback < ' tcx , Q > ( is_anon : bool , is_eval_always : bool ) -> DepKindStruct < ' tcx >
492+ pub ( crate ) fn make_dep_kind_vtable_for_query < ' tcx , Q > (
493+ is_anon : bool ,
494+ is_eval_always : bool ,
495+ ) -> DepKindVTable < ' tcx >
493496where
494497 Q : QueryConfigRestored < ' tcx > ,
495498{
496499 let fingerprint_style = <Q :: Config as QueryConfig < QueryCtxt < ' tcx > > >:: Key :: fingerprint_style ( ) ;
497500
498501 if is_anon || !fingerprint_style. reconstructible ( ) {
499- return DepKindStruct {
502+ return DepKindVTable {
500503 is_anon,
501504 is_eval_always,
502505 fingerprint_style,
@@ -506,7 +509,7 @@ where
506509 } ;
507510 }
508511
509- DepKindStruct {
512+ DepKindVTable {
510513 is_anon,
511514 is_eval_always,
512515 fingerprint_style,
@@ -811,15 +814,19 @@ macro_rules! define_queries {
811814 for <' tcx> fn ( TyCtxt <' tcx>)
812815 ] = & [ $( query_impl:: $name:: query_key_hash_verify) ,* ] ;
813816
814- #[ allow( nonstandard_style) ]
815- mod query_callbacks {
817+ /// Module containing a named function for each dep kind (including queries)
818+ /// that creates a `DepKindVTable`.
819+ ///
820+ /// Consumed via `make_dep_kind_array!` to create a list of vtables.
821+ #[ expect( non_snake_case) ]
822+ mod _dep_kind_vtable_ctors {
816823 use super :: * ;
817824 use rustc_middle:: bug;
818825 use rustc_query_system:: dep_graph:: FingerprintStyle ;
819826
820827 // We use this for most things when incr. comp. is turned off.
821- pub ( crate ) fn Null <' tcx>( ) -> DepKindStruct <' tcx> {
822- DepKindStruct {
828+ pub ( crate ) fn Null <' tcx>( ) -> DepKindVTable <' tcx> {
829+ DepKindVTable {
823830 is_anon: false ,
824831 is_eval_always: false ,
825832 fingerprint_style: FingerprintStyle :: Unit ,
@@ -830,8 +837,8 @@ macro_rules! define_queries {
830837 }
831838
832839 // We use this for the forever-red node.
833- pub ( crate ) fn Red <' tcx>( ) -> DepKindStruct <' tcx> {
834- DepKindStruct {
840+ pub ( crate ) fn Red <' tcx>( ) -> DepKindVTable <' tcx> {
841+ DepKindVTable {
835842 is_anon: false ,
836843 is_eval_always: false ,
837844 fingerprint_style: FingerprintStyle :: Unit ,
@@ -841,8 +848,8 @@ macro_rules! define_queries {
841848 }
842849 }
843850
844- pub ( crate ) fn SideEffect <' tcx>( ) -> DepKindStruct <' tcx> {
845- DepKindStruct {
851+ pub ( crate ) fn SideEffect <' tcx>( ) -> DepKindVTable <' tcx> {
852+ DepKindVTable {
846853 is_anon: false ,
847854 is_eval_always: false ,
848855 fingerprint_style: FingerprintStyle :: Unit ,
@@ -855,8 +862,8 @@ macro_rules! define_queries {
855862 }
856863 }
857864
858- pub ( crate ) fn AnonZeroDeps <' tcx>( ) -> DepKindStruct <' tcx> {
859- DepKindStruct {
865+ pub ( crate ) fn AnonZeroDeps <' tcx>( ) -> DepKindVTable <' tcx> {
866+ DepKindVTable {
860867 is_anon: true ,
861868 is_eval_always: false ,
862869 fingerprint_style: FingerprintStyle :: Opaque ,
@@ -866,8 +873,8 @@ macro_rules! define_queries {
866873 }
867874 }
868875
869- pub ( crate ) fn TraitSelect <' tcx>( ) -> DepKindStruct <' tcx> {
870- DepKindStruct {
876+ pub ( crate ) fn TraitSelect <' tcx>( ) -> DepKindVTable <' tcx> {
877+ DepKindVTable {
871878 is_anon: true ,
872879 is_eval_always: false ,
873880 fingerprint_style: FingerprintStyle :: Unit ,
@@ -877,8 +884,8 @@ macro_rules! define_queries {
877884 }
878885 }
879886
880- pub ( crate ) fn CompileCodegenUnit <' tcx>( ) -> DepKindStruct <' tcx> {
881- DepKindStruct {
887+ pub ( crate ) fn CompileCodegenUnit <' tcx>( ) -> DepKindVTable <' tcx> {
888+ DepKindVTable {
882889 is_anon: false ,
883890 is_eval_always: false ,
884891 fingerprint_style: FingerprintStyle :: Opaque ,
@@ -888,8 +895,8 @@ macro_rules! define_queries {
888895 }
889896 }
890897
891- pub ( crate ) fn CompileMonoItem <' tcx>( ) -> DepKindStruct <' tcx> {
892- DepKindStruct {
898+ pub ( crate ) fn CompileMonoItem <' tcx>( ) -> DepKindVTable <' tcx> {
899+ DepKindVTable {
893900 is_anon: false ,
894901 is_eval_always: false ,
895902 fingerprint_style: FingerprintStyle :: Opaque ,
@@ -899,8 +906,8 @@ macro_rules! define_queries {
899906 }
900907 }
901908
902- pub ( crate ) fn Metadata <' tcx>( ) -> DepKindStruct <' tcx> {
903- DepKindStruct {
909+ pub ( crate ) fn Metadata <' tcx>( ) -> DepKindVTable <' tcx> {
910+ DepKindVTable {
904911 is_anon: false ,
905912 is_eval_always: false ,
906913 fingerprint_style: FingerprintStyle :: Unit ,
@@ -910,16 +917,17 @@ macro_rules! define_queries {
910917 }
911918 }
912919
913- $( pub ( crate ) fn $name<' tcx>( ) -> DepKindStruct <' tcx> {
914- $crate:: plumbing:: query_callback:: <query_impl:: $name:: QueryType <' tcx>>(
920+ $( pub ( crate ) fn $name<' tcx>( ) -> DepKindVTable <' tcx> {
921+ use $crate:: query_impl:: $name:: QueryType ;
922+ $crate:: plumbing:: make_dep_kind_vtable_for_query:: <QueryType <' tcx>>(
915923 is_anon!( [ $( $modifiers) * ] ) ,
916924 is_eval_always!( [ $( $modifiers) * ] ) ,
917925 )
918926 } ) *
919927 }
920928
921- pub fn query_callbacks <' tcx>( arena: & ' tcx Arena <' tcx>) -> & ' tcx [ DepKindStruct <' tcx>] {
922- arena. alloc_from_iter( rustc_middle:: make_dep_kind_array!( query_callbacks ) )
929+ pub fn make_dep_kind_vtables <' tcx>( arena: & ' tcx Arena <' tcx>) -> & ' tcx [ DepKindVTable <' tcx>] {
930+ arena. alloc_from_iter( rustc_middle:: make_dep_kind_array!( _dep_kind_vtable_ctors ) )
923931 }
924932 }
925933}
0 commit comments