@@ -46,11 +46,11 @@ enum QueryResult {
46
46
47
47
impl QueryResult {
48
48
/// Unwraps the query job expecting that it has started.
49
- fn expect_job ( self , query_name : & ' static str ) -> QueryJob {
49
+ fn expect_job ( self ) -> QueryJob {
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" )
54
54
}
55
55
}
56
56
}
@@ -107,7 +107,6 @@ where
107
107
{
108
108
state : & ' tcx QueryState < K > ,
109
109
key : K ,
110
- query_name : & ' static str ,
111
110
}
112
111
113
112
#[ cold]
@@ -173,18 +172,18 @@ where
173
172
let key = self . key ;
174
173
let state = self . state ;
175
174
175
+ // Forget ourself so our destructor won't poison the query
176
+ mem:: forget ( self ) ;
177
+
176
178
// Mark as complete before we remove the job from the active state
177
179
// so no other thread can re-execute this query.
178
180
cache. complete ( key, result, dep_node_index) ;
179
181
180
182
let job = {
181
183
let mut lock = state. active . lock_shard_by_value ( & key) ;
182
- lock. remove ( & key) . unwrap ( ) . expect_job ( self . query_name )
184
+ lock. remove ( & key) . unwrap ( ) . expect_job ( )
183
185
} ;
184
186
185
- // Forget ourself so our destructor won't poison the query
186
- mem:: forget ( self ) ;
187
-
188
187
job. signal_complete ( ) ;
189
188
}
190
189
}
@@ -200,7 +199,7 @@ where
200
199
let state = self . state ;
201
200
let job = {
202
201
let mut shard = state. active . lock_shard_by_value ( & self . key ) ;
203
- let job = shard. remove ( & self . key ) . unwrap ( ) . expect_job ( self . query_name ) ;
202
+ let job = shard. remove ( & self . key ) . unwrap ( ) . expect_job ( ) ;
204
203
205
204
shard. insert ( self . key , QueryResult :: Poisoned ) ;
206
205
job
@@ -286,13 +285,15 @@ where
286
285
// poisoned due to a panic instead.
287
286
let lock = query. query_state ( qcx) . active . get_shard_by_value ( & key) . lock ( ) ;
288
287
289
- if let Some ( QueryResult :: Poisoned ) = lock. get ( & key) {
290
- panic ! ( "query '{}' not cached due to poisoning" , query. name( ) )
288
+ match lock. get ( & key) {
289
+ Some ( QueryResult :: Poisoned ) => {
290
+ panic ! ( "query '{}' not cached due to poisoning" , query. name( ) )
291
+ }
292
+ _ => panic ! (
293
+ "query '{}' result must be in the cache or the query must be poisoned after a wait" ,
294
+ query. name( )
295
+ ) ,
291
296
}
292
- panic ! (
293
- "query '{}' result must in the cache or the query must be poisoned after a wait" ,
294
- query. name( )
295
- )
296
297
} )
297
298
} ;
298
299
@@ -391,7 +392,7 @@ where
391
392
Qcx : QueryContext ,
392
393
{
393
394
// Use `JobOwner` so the query will be poisoned if executing it panics.
394
- let job_owner = JobOwner { state, key, query_name : query . name ( ) } ;
395
+ let job_owner = JobOwner { state, key } ;
395
396
396
397
debug_assert_eq ! ( qcx. dep_context( ) . dep_graph( ) . is_fully_enabled( ) , INCR ) ;
397
398
0 commit comments