@@ -842,55 +842,6 @@ macro_rules! define_queries_inner {
842
842
input: ( $( ( [ $( $modifiers) * ] [ $( $attr) * ] [ $name] ) ) * )
843
843
}
844
844
845
- impl <$tcx> Queries <$tcx> {
846
- pub fn new(
847
- providers: IndexVec <CrateNum , Providers <$tcx>>,
848
- fallback_extern_providers: Providers <$tcx>,
849
- on_disk_cache: OnDiskCache <' tcx>,
850
- ) -> Self {
851
- Queries {
852
- providers,
853
- fallback_extern_providers: Box :: new( fallback_extern_providers) ,
854
- on_disk_cache,
855
- $( $name: Default :: default ( ) ) ,*
856
- }
857
- }
858
-
859
- pub fn try_collect_active_jobs(
860
- & self
861
- ) -> Option <FxHashMap <QueryJobId , QueryJobInfo <' tcx>>> {
862
- let mut jobs = FxHashMap :: default ( ) ;
863
-
864
- $(
865
- // We use try_lock_shards here since we are called from the
866
- // deadlock handler, and this shouldn't be locked.
867
- let shards = self . $name. shards. try_lock_shards( ) ?;
868
- let shards = shards. iter( ) . enumerate( ) ;
869
- jobs. extend( shards. flat_map( |( shard_id, shard) | {
870
- shard. active. iter( ) . filter_map( move |( k, v) | {
871
- if let QueryResult :: Started ( ref job) = * v {
872
- let id = QueryJobId {
873
- job: job. id,
874
- shard: u16 :: try_from( shard_id) . unwrap( ) ,
875
- kind:
876
- <queries:: $name<' tcx> as QueryAccessors <' tcx>>:: DEP_KIND ,
877
- } ;
878
- let info = QueryInfo {
879
- span: job. span,
880
- query: Query :: $name( k. clone( ) )
881
- } ;
882
- Some ( ( id, QueryJobInfo { info, job: job. clone( ) } ) )
883
- } else {
884
- None
885
- }
886
- } )
887
- } ) ) ;
888
- ) *
889
-
890
- Some ( jobs)
891
- }
892
- }
893
-
894
845
#[ allow( nonstandard_style) ]
895
846
#[ derive( Clone , Debug ) ]
896
847
pub enum Query <$tcx> {
@@ -1120,6 +1071,55 @@ macro_rules! define_queries_struct {
1120
1071
1121
1072
$( $( #[ $attr] ) * $name: QueryState <$tcx, queries:: $name<$tcx>>, ) *
1122
1073
}
1074
+
1075
+ impl <$tcx> Queries <$tcx> {
1076
+ pub fn new(
1077
+ providers: IndexVec <CrateNum , Providers <$tcx>>,
1078
+ fallback_extern_providers: Providers <$tcx>,
1079
+ on_disk_cache: OnDiskCache <' tcx>,
1080
+ ) -> Self {
1081
+ Queries {
1082
+ providers,
1083
+ fallback_extern_providers: Box :: new( fallback_extern_providers) ,
1084
+ on_disk_cache,
1085
+ $( $name: Default :: default ( ) ) ,*
1086
+ }
1087
+ }
1088
+
1089
+ pub fn try_collect_active_jobs(
1090
+ & self
1091
+ ) -> Option <FxHashMap <QueryJobId , QueryJobInfo <' tcx>>> {
1092
+ let mut jobs = FxHashMap :: default ( ) ;
1093
+
1094
+ $(
1095
+ // We use try_lock_shards here since we are called from the
1096
+ // deadlock handler, and this shouldn't be locked.
1097
+ let shards = self . $name. shards. try_lock_shards( ) ?;
1098
+ let shards = shards. iter( ) . enumerate( ) ;
1099
+ jobs. extend( shards. flat_map( |( shard_id, shard) | {
1100
+ shard. active. iter( ) . filter_map( move |( k, v) | {
1101
+ if let QueryResult :: Started ( ref job) = * v {
1102
+ let id = QueryJobId {
1103
+ job: job. id,
1104
+ shard: u16 :: try_from( shard_id) . unwrap( ) ,
1105
+ kind:
1106
+ <queries:: $name<' tcx> as QueryAccessors <' tcx>>:: DEP_KIND ,
1107
+ } ;
1108
+ let info = QueryInfo {
1109
+ span: job. span,
1110
+ query: Query :: $name( k. clone( ) )
1111
+ } ;
1112
+ Some ( ( id, QueryJobInfo { info, job: job. clone( ) } ) )
1113
+ } else {
1114
+ None
1115
+ }
1116
+ } )
1117
+ } ) ) ;
1118
+ ) *
1119
+
1120
+ Some ( jobs)
1121
+ }
1122
+ }
1123
1123
} ;
1124
1124
}
1125
1125
0 commit comments