@@ -38,7 +38,7 @@ pub struct QueryInfo {
3838pub type QueryMap = FxHashMap < QueryJobId , QueryJobInfo > ;
3939
4040/// A value uniquely identifying an active query job.
41- #[ derive( Copy , Clone , Eq , PartialEq , Hash ) ]
41+ #[ derive( Copy , Clone , Eq , PartialEq , Hash , Debug ) ]
4242pub struct QueryJobId ( pub NonZeroU64 ) ;
4343
4444impl QueryJobId {
@@ -62,14 +62,14 @@ impl QueryJobId {
6262 }
6363}
6464
65- #[ derive( Clone ) ]
65+ #[ derive( Clone , Debug ) ]
6666pub struct QueryJobInfo {
6767 pub query : QueryStackFrame ,
6868 pub job : QueryJob ,
6969}
7070
7171/// Represents an active query job.
72- #[ derive( Clone ) ]
72+ #[ derive( Clone , Debug ) ]
7373pub struct QueryJob {
7474 pub id : QueryJobId ,
7575
@@ -182,6 +182,7 @@ impl QueryJobId {
182182}
183183
184184#[ cfg( parallel_compiler) ]
185+ #[ derive( Debug ) ]
185186struct QueryWaiter {
186187 query : Option < QueryJobId > ,
187188 condvar : Condvar ,
@@ -198,13 +199,14 @@ impl QueryWaiter {
198199}
199200
200201#[ cfg( parallel_compiler) ]
202+ #[ derive( Debug ) ]
201203struct QueryLatchInfo {
202204 complete : bool ,
203205 waiters : Vec < Arc < QueryWaiter > > ,
204206}
205207
206208#[ cfg( parallel_compiler) ]
207- #[ derive( Clone ) ]
209+ #[ derive( Clone , Debug ) ]
208210pub ( super ) struct QueryLatch {
209211 info : Arc < Mutex < QueryLatchInfo > > ,
210212}
@@ -540,7 +542,11 @@ pub fn deadlock(query_map: QueryMap, registry: &rayon_core::Registry) {
540542 // X to Y due to Rayon waiting and a true dependency from Y to X. The algorithm here
541543 // only considers the true dependency and won't detect a cycle.
542544 if !found_cycle {
543- panic ! ( "deadlock detected" ) ;
545+ if query_map. len ( ) == 0 {
546+ panic ! ( "deadlock detected without any query!" )
547+ } else {
548+ panic ! ( "deadlock detected! current query map:\n {:?}" , query_map) ;
549+ }
544550 }
545551
546552 // FIXME: Ensure this won't cause a deadlock before we return
0 commit comments