@@ -17,10 +17,9 @@ use std::num::NonZero;
1717use {
1818 parking_lot:: { Condvar , Mutex } ,
1919 rustc_data_structures:: fx:: FxHashSet ,
20- rustc_data_structures:: { defer , jobserver} ,
20+ rustc_data_structures:: jobserver,
2121 rustc_span:: DUMMY_SP ,
2222 std:: iter,
23- std:: process,
2423 std:: sync:: Arc ,
2524} ;
2625
@@ -514,12 +513,7 @@ fn remove_cycle(
514513/// There may be multiple cycles involved in a deadlock, so this searches
515514/// all active queries for cycles before finally resuming all the waiters at once.
516515#[ 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 ) {
523517 let mut wakelist = Vec :: new ( ) ;
524518 let mut jobs: Vec < QueryJobId > = query_map. keys ( ) . cloned ( ) . collect ( ) ;
525519
@@ -539,19 +533,17 @@ pub fn deadlock(query_map: QueryMap, registry: &rayon_core::Registry) {
539533 // X to Y due to Rayon waiting and a true dependency from Y to X. The algorithm here
540534 // only considers the true dependency and won't detect a cycle.
541535 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+ ) ;
547541 }
548542
549543 // FIXME: Ensure this won't cause a deadlock before we return
550544 for waiter in wakelist. into_iter ( ) {
551545 waiter. notify ( registry) ;
552546 }
553-
554- on_panic. disable ( ) ;
555547}
556548
557549#[ inline( never) ]
0 commit comments