@@ -50,7 +50,7 @@ impl QueryResult {
5050 match self {
5151 Self :: Started ( job) => job,
5252 Self :: Poisoned => {
53- panic ! ( "job for query {} failed to start and was poisoned" , query_name)
53+ panic ! ( "job for query '{}' failed to start and was poisoned" , query_name)
5454 }
5555 }
5656 }
@@ -166,16 +166,13 @@ where
166166{
167167 /// Completes the query by updating the query cache with the `result`,
168168 /// signals the waiter and forgets the JobOwner, so it won't poison the query
169- fn complete < C , Q > ( self , cache : & C , result : C :: Value , dep_node_index : DepNodeIndex )
169+ fn complete < C > ( self , cache : & C , result : C :: Value , dep_node_index : DepNodeIndex )
170170 where
171171 C : QueryCache < Key = K > ,
172172 {
173173 let key = self . key ;
174174 let state = self . state ;
175175
176- // Forget ourself so our destructor won't poison the query
177- mem:: forget ( self ) ;
178-
179176 // Mark as complete before we remove the job from the active state
180177 // so no other thread can re-execute this query.
181178 cache. complete ( key, result, dep_node_index) ;
@@ -185,6 +182,9 @@ where
185182 lock. remove ( & key) . unwrap ( ) . expect_job ( self . query_name )
186183 } ;
187184
185+ // Forget ourself so our destructor won't poison the query
186+ mem:: forget ( self ) ;
187+
188188 job. signal_complete ( ) ;
189189 }
190190}
@@ -285,12 +285,14 @@ where
285285 // We didn't find the query result in the query cache. Check if it was
286286 // poisoned due to a panic instead.
287287 let lock = query. query_state ( qcx) . active . get_shard_by_value ( & key) . lock ( ) ;
288- match lock. get ( & key) {
289- Some ( poisoned @ QueryResult :: Poisoned ) => poisoned. expect_job ( query. name ( ) ) ,
290- _ => panic ! (
291- "query result must in the cache or the query must be poisoned after a wait"
292- ) ,
288+
289+ if let Some ( QueryResult :: Poisoned ) = lock. get ( & key) {
290+ panic ! ( "query '{}' not cached due to poisoning" , query. name( ) )
293291 }
292+ panic ! (
293+ "query '{}' result must in the cache or the query must be poisoned after a wait" ,
294+ query. name( )
295+ )
294296 } )
295297 } ;
296298
@@ -368,7 +370,7 @@ where
368370 cycle_error ( query, qcx, id, span)
369371 }
370372 QueryResult :: Poisoned => {
371- panic ! ( "job for query {} failed to start and was poisoned" , query. name( ) )
373+ panic ! ( "job for query '{}' failed to start and was poisoned" , query. name( ) )
372374 }
373375 }
374376 }
0 commit comments