@@ -99,6 +99,8 @@ macro_rules! profq_key {
99
99
}
100
100
}
101
101
102
+ /// A type representing the responsibility to execute the job in the `job` field.
103
+ /// This will poison the relevant query if dropped.
102
104
pub ( super ) struct JobOwner < ' a , ' tcx : ' a , Q : QueryDescription < ' tcx > + ' a > {
103
105
map : & ' a Lock < QueryMap < ' tcx , Q > > ,
104
106
key : Q :: Key ,
@@ -165,6 +167,8 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
165
167
}
166
168
}
167
169
170
+ /// Completes the query by updating the query map with the `result`,
171
+ /// signals the waiter and forgets the JobOwner, so it won't poison the query
168
172
pub ( super ) fn complete ( self , result : & Q :: Value , dep_node_index : DepNodeIndex ) {
169
173
// We can move out of `self` here because we `mem::forget` it below
170
174
let key = unsafe { ptr:: read ( & self . key ) } ;
@@ -180,14 +184,14 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
180
184
job. signal_complete ( ) ;
181
185
}
182
186
183
- /// Creates a job for the query and updates the query map indicating that it started.
184
- /// Then it changes ImplicitCtxt to point to the new query job while it executes.
185
- /// If the query panics, this updates the query map to indicate so .
187
+ /// Executes a job by changing the ImplicitCtxt to point to the
188
+ /// new query job while it executes. It returns the diagnostics
189
+ /// captured during execution and the actual result .
186
190
pub ( super ) fn start < ' lcx , F , R > (
187
191
& self ,
188
192
tcx : TyCtxt < ' _ , ' tcx , ' lcx > ,
189
193
compute : F )
190
- -> Result < ( R , Vec < Diagnostic > ) , CycleError < ' tcx > >
194
+ -> ( R , Vec < Diagnostic > )
191
195
where
192
196
F : for < ' b > FnOnce ( TyCtxt < ' b , ' tcx , ' lcx > ) -> R
193
197
{
@@ -538,7 +542,7 @@ macro_rules! define_maps {
538
542
tcx. dep_graph. with_anon_task( dep_node. kind, || {
539
543
Self :: compute_result( tcx. global_tcx( ) , key)
540
544
} )
541
- } ) ? ;
545
+ } ) ;
542
546
543
547
profq_msg!( tcx, ProfileQueriesMsg :: ProviderEnd ) ;
544
548
let ( ( result, dep_node_index) , diagnostics) = res;
@@ -649,7 +653,7 @@ macro_rules! define_maps {
649
653
tcx. dep_graph. with_ignore( || {
650
654
Self :: compute_result( tcx, key)
651
655
} )
652
- } ) ? ;
656
+ } ) ;
653
657
result
654
658
} ;
655
659
@@ -736,7 +740,7 @@ macro_rules! define_maps {
736
740
key,
737
741
Self :: compute_result)
738
742
}
739
- } ) ? ;
743
+ } ) ;
740
744
profq_msg!( tcx, ProfileQueriesMsg :: ProviderEnd ) ;
741
745
742
746
let ( ( result, dep_node_index) , diagnostics) = res;
0 commit comments