@@ -27,6 +27,7 @@ use rustc_query_system::{LayoutOfDepth, QueryOverflow};
27
27
use rustc_serialize:: Decodable ;
28
28
use rustc_serialize:: Encodable ;
29
29
use rustc_session:: Limit ;
30
+ use rustc_session:: ProgressBars ;
30
31
use rustc_span:: def_id:: LOCAL_CRATE ;
31
32
use std:: num:: NonZeroU64 ;
32
33
use thin_vec:: ThinVec ;
@@ -413,6 +414,24 @@ where
413
414
value
414
415
}
415
416
417
+ macro_rules! trace_query {
418
+ ( $tcx: expr, $name: ident, $key: ident) => {
419
+ #[ cfg( debug_assertions) ]
420
+ let _guard = tracing:: span!( tracing:: Level :: TRACE , stringify!( $name) , ?$key) . entered( ) ;
421
+ let _spinner = $tcx
422
+ . sess
423
+ . progress_bars
424
+ . as_ref( )
425
+ . map( |bars| $crate:: plumbing:: update_spinner( $tcx, bars, stringify!( $name) ) ) ;
426
+ } ;
427
+ }
428
+
429
+ #[ inline( never) ]
430
+ #[ cold]
431
+ pub fn update_spinner ( tcx : TyCtxt < ' _ > , bars : & ProgressBars , name : & ' static str ) -> impl Sized {
432
+ tcx. sess . push_spinner ( bars, name)
433
+ }
434
+
416
435
fn force_from_dep_node < ' tcx , Q > ( query : Q , tcx : TyCtxt < ' tcx > , dep_node : DepNode ) -> bool
417
436
where
418
437
Q : QueryConfig < QueryCtxt < ' tcx > > ,
@@ -437,7 +456,7 @@ where
437
456
438
457
if let Some ( key) = Q :: Key :: recover ( tcx, & dep_node) {
439
458
#[ cfg( debug_assertions) ]
440
- let _guard = tracing:: span!( tracing:: Level :: TRACE , stringify! ( $name ) , ?key) . entered ( ) ;
459
+ let _guard = tracing:: span!( tracing:: Level :: TRACE , "force" , ?dep_node . kind , ?key) . entered ( ) ;
441
460
force_query ( query, QueryCtxt :: new ( tcx) , key, dep_node) ;
442
461
true
443
462
} else {
@@ -531,8 +550,7 @@ macro_rules! define_queries {
531
550
key: queries:: $name:: Key <' tcx>,
532
551
mode: QueryMode ,
533
552
) -> Option <Erase <queries:: $name:: Value <' tcx>>> {
534
- #[ cfg( debug_assertions) ]
535
- let _guard = tracing:: span!( tracing:: Level :: TRACE , stringify!( $name) , ?key) . entered( ) ;
553
+ trace_query!( tcx, $name, key) ;
536
554
get_query_incr(
537
555
QueryType :: config( tcx) ,
538
556
QueryCtxt :: new( tcx) ,
@@ -573,8 +591,7 @@ macro_rules! define_queries {
573
591
cache_on_disk: |tcx, key| :: rustc_middle:: query:: cached:: $name( tcx, key) ,
574
592
execute_query: |tcx, key| erase( tcx. $name( key) ) ,
575
593
compute: |tcx, key| {
576
- #[ cfg( debug_assertions) ]
577
- let _guard = tracing:: span!( tracing:: Level :: TRACE , stringify!( $name) , ?key) . entered( ) ;
594
+ trace_query!( tcx, $name, key) ;
578
595
__rust_begin_short_backtrace( ||
579
596
queries:: $name:: provided_to_erased(
580
597
tcx,
0 commit comments