@@ -19,7 +19,7 @@ use rustc_session::{EarlyDiagCtxt, Session, filesearch};
19
19
use rustc_span:: edit_distance:: find_best_match_for_name;
20
20
use rustc_span:: edition:: Edition ;
21
21
use rustc_span:: source_map:: SourceMapInputs ;
22
- use rustc_span:: { SessionGlobals , Symbol , sym} ;
22
+ use rustc_span:: { Symbol , sym} ;
23
23
use rustc_target:: spec:: Target ;
24
24
use tracing:: info;
25
25
@@ -175,13 +175,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
175
175
sm_inputs : SourceMapInputs ,
176
176
f : F ,
177
177
) -> R {
178
- use std:: process;
179
-
180
- use rustc_data_structures:: defer;
181
178
use rustc_data_structures:: sync:: FromDyn ;
182
- use rustc_middle:: ty:: tls;
183
- use rustc_query_impl:: QueryCtxt ;
184
- use rustc_query_system:: query:: { QueryContext , break_query_cycles} ;
185
179
186
180
let thread_stack_size = init_stack_size ( thread_builder_diag) ;
187
181
@@ -203,7 +197,6 @@ pub(crate) fn run_in_thread_pool_with_globals<
203
197
}
204
198
205
199
let current_gcx = FromDyn :: from ( CurrentGcx :: new ( ) ) ;
206
- let current_gcx2 = current_gcx. clone ( ) ;
207
200
208
201
let proxy = Proxy :: new ( ) ;
209
202
@@ -214,46 +207,6 @@ pub(crate) fn run_in_thread_pool_with_globals<
214
207
. acquire_thread_handler ( move || proxy_. acquire_thread ( ) )
215
208
. release_thread_handler ( move || proxy__. release_thread ( ) )
216
209
. num_threads ( threads)
217
- . deadlock_handler ( move || {
218
- // On deadlock, creates a new thread and forwards information in thread
219
- // locals to it. The new thread runs the deadlock handler.
220
-
221
- let current_gcx2 = current_gcx2. clone ( ) ;
222
- let registry = rayon_core:: Registry :: current ( ) ;
223
- let session_globals = rustc_span:: with_session_globals ( |session_globals| {
224
- session_globals as * const SessionGlobals as usize
225
- } ) ;
226
- thread:: Builder :: new ( )
227
- . name ( "rustc query cycle handler" . to_string ( ) )
228
- . spawn ( move || {
229
- let on_panic = defer ( || {
230
- eprintln ! ( "internal compiler error: query cycle handler thread panicked, aborting process" ) ;
231
- // We need to abort here as we failed to resolve the deadlock,
232
- // otherwise the compiler could just hang,
233
- process:: abort ( ) ;
234
- } ) ;
235
-
236
- // Get a `GlobalCtxt` reference from `CurrentGcx` as we cannot rely on having a
237
- // `TyCtxt` TLS reference here.
238
- current_gcx2. access ( |gcx| {
239
- tls:: enter_context ( & tls:: ImplicitCtxt :: new ( gcx) , || {
240
- tls:: with ( |tcx| {
241
- // Accessing session globals is sound as they outlive `GlobalCtxt`.
242
- // They are needed to hash query keys containing spans or symbols.
243
- let query_map = rustc_span:: set_session_globals_then ( unsafe { & * ( session_globals as * const SessionGlobals ) } , || {
244
- // Ensure there was no errors collecting all active jobs.
245
- // We need the complete map to ensure we find a cycle to break.
246
- QueryCtxt :: new ( tcx) . collect_active_jobs ( ) . ok ( ) . expect ( "failed to collect active queries in deadlock handler" )
247
- } ) ;
248
- break_query_cycles ( query_map, & registry) ;
249
- } )
250
- } )
251
- } ) ;
252
-
253
- on_panic. disable ( ) ;
254
- } )
255
- . unwrap ( ) ;
256
- } )
257
210
. stack_size ( thread_stack_size) ;
258
211
259
212
// We create the session globals on the main thread, then create the thread
0 commit comments