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