@@ -17,10 +17,9 @@ use std::num::NonZero;
17
17
use {
18
18
parking_lot:: { Condvar , Mutex } ,
19
19
rustc_data_structures:: fx:: FxHashSet ,
20
- rustc_data_structures:: { defer , jobserver} ,
20
+ rustc_data_structures:: jobserver,
21
21
rustc_span:: DUMMY_SP ,
22
22
std:: iter,
23
- std:: process,
24
23
std:: sync:: Arc ,
25
24
} ;
26
25
@@ -514,12 +513,7 @@ fn remove_cycle(
514
513
/// There may be multiple cycles involved in a deadlock, so this searches
515
514
/// all active queries for cycles before finally resuming all the waiters at once.
516
515
#[ cfg( parallel_compiler) ]
517
- pub fn deadlock ( query_map : QueryMap , registry : & rayon_core:: Registry ) {
518
- let on_panic = defer ( || {
519
- eprintln ! ( "deadlock handler panicked, aborting process" ) ;
520
- process:: abort ( ) ;
521
- } ) ;
522
-
516
+ pub fn break_query_cycles ( query_map : QueryMap , registry : & rayon_core:: Registry ) {
523
517
let mut wakelist = Vec :: new ( ) ;
524
518
let mut jobs: Vec < QueryJobId > = query_map. keys ( ) . cloned ( ) . collect ( ) ;
525
519
@@ -539,19 +533,17 @@ pub fn deadlock(query_map: QueryMap, registry: &rayon_core::Registry) {
539
533
// X to Y due to Rayon waiting and a true dependency from Y to X. The algorithm here
540
534
// only considers the true dependency and won't detect a cycle.
541
535
if !found_cycle {
542
- if query_map . len ( ) == 0 {
543
- panic ! ( "deadlock detected without any query!" )
544
- } else {
545
- panic ! ( "deadlock detected! current query map: \n {:#?}" , query_map) ;
546
- }
536
+ panic ! (
537
+ "deadlock detected as we're unable to find a query cycle to break \n \
538
+ current query map: \n {:#?}" ,
539
+ query_map
540
+ ) ;
547
541
}
548
542
549
543
// FIXME: Ensure this won't cause a deadlock before we return
550
544
for waiter in wakelist. into_iter ( ) {
551
545
waiter. notify ( registry) ;
552
546
}
553
-
554
- on_panic. disable ( ) ;
555
547
}
556
548
557
549
#[ inline( never) ]
0 commit comments