This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
compiler/rustc_query_system/src/query Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ use std::collections::hash_map::Entry;
2525use std:: fmt:: Debug ;
2626use std:: hash:: Hash ;
2727use std:: mem;
28- use std:: ptr;
2928use thin_vec:: ThinVec ;
3029
3130use super :: QueryConfig ;
@@ -250,13 +249,16 @@ where
250249 where
251250 C : QueryCache < Key = K > ,
252251 {
253- // We can move out of `self` here because we `mem::forget` it below
254- let key = unsafe { ptr:: read ( & self . key ) } ;
252+ let key = self . key ;
255253 let state = self . state ;
256254
257255 // Forget ourself so our destructor won't poison the query
258256 mem:: forget ( self ) ;
259257
258+ // Mark as complete before we remove the job from the active state
259+ // so no other thread can re-execute this query.
260+ cache. complete ( key, result, dep_node_index) ;
261+
260262 let job = {
261263 #[ cfg( parallel_compiler) ]
262264 let mut lock = state. active . get_shard_by_value ( & key) . lock ( ) ;
@@ -267,7 +269,6 @@ where
267269 QueryResult :: Poisoned => panic ! ( ) ,
268270 }
269271 } ;
270- cache. complete ( key, result, dep_node_index) ;
271272
272273 job. signal_complete ( ) ;
273274 }
You can’t perform that action at this time.
0 commit comments