@@ -50,7 +50,7 @@ impl QueryResult {
50
50
match self {
51
51
Self :: Started ( job) => job,
52
52
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)
54
54
}
55
55
}
56
56
}
@@ -166,16 +166,13 @@ where
166
166
{
167
167
/// Completes the query by updating the query cache with the `result`,
168
168
/// 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 )
170
170
where
171
171
C : QueryCache < Key = K > ,
172
172
{
173
173
let key = self . key ;
174
174
let state = self . state ;
175
175
176
- // Forget ourself so our destructor won't poison the query
177
- mem:: forget ( self ) ;
178
-
179
176
// Mark as complete before we remove the job from the active state
180
177
// so no other thread can re-execute this query.
181
178
cache. complete ( key, result, dep_node_index) ;
@@ -185,6 +182,9 @@ where
185
182
lock. remove ( & key) . unwrap ( ) . expect_job ( self . query_name )
186
183
} ;
187
184
185
+ // Forget ourself so our destructor won't poison the query
186
+ mem:: forget ( self ) ;
187
+
188
188
job. signal_complete ( ) ;
189
189
}
190
190
}
@@ -285,12 +285,14 @@ where
285
285
// We didn't find the query result in the query cache. Check if it was
286
286
// poisoned due to a panic instead.
287
287
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( ) )
293
291
}
292
+ panic ! (
293
+ "query '{}' result must in the cache or the query must be poisoned after a wait" ,
294
+ query. name( )
295
+ )
294
296
} )
295
297
} ;
296
298
@@ -368,7 +370,7 @@ where
368
370
cycle_error ( query, qcx, id, span)
369
371
}
370
372
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( ) )
372
374
}
373
375
}
374
376
}
0 commit comments