@@ -27,6 +27,7 @@ use rustc_query_system::{LayoutOfDepth, QueryOverflow};
2727use rustc_serialize:: Decodable ;
2828use rustc_serialize:: Encodable ;
2929use rustc_session:: Limit ;
30+ use rustc_session:: ProgressBars ;
3031use rustc_span:: def_id:: LOCAL_CRATE ;
3132use std:: num:: NonZeroU64 ;
3233use thin_vec:: ThinVec ;
@@ -413,6 +414,24 @@ where
413414 value
414415}
415416
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+
416435fn force_from_dep_node < ' tcx , Q > ( query : Q , tcx : TyCtxt < ' tcx > , dep_node : DepNode ) -> bool
417436where
418437 Q : QueryConfig < QueryCtxt < ' tcx > > ,
@@ -437,7 +456,7 @@ where
437456
438457 if let Some ( key) = Q :: Key :: recover ( tcx, & dep_node) {
439458 #[ 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 ( ) ;
441460 force_query ( query, QueryCtxt :: new ( tcx) , key, dep_node) ;
442461 true
443462 } else {
@@ -531,8 +550,7 @@ macro_rules! define_queries {
531550 key: queries:: $name:: Key <' tcx>,
532551 mode: QueryMode ,
533552 ) -> 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) ;
536554 get_query_incr(
537555 QueryType :: config( tcx) ,
538556 QueryCtxt :: new( tcx) ,
@@ -573,8 +591,7 @@ macro_rules! define_queries {
573591 cache_on_disk: |tcx, key| :: rustc_middle:: query:: cached:: $name( tcx, key) ,
574592 execute_query: |tcx, key| erase( tcx. $name( key) ) ,
575593 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) ;
578595 __rust_begin_short_backtrace( ||
579596 queries:: $name:: provided_to_erased(
580597 tcx,
0 commit comments