Skip to content

Commit 4f6c48b

Browse files
Rollup merge of #112883 - oli-obk:tracing_queries, r=cjgillot
Make queries traceable again This can't be tested without something along the lines of #111924 unfortunately. We could benchmark turning query tracing into an `info` level tracing statement, but let's get this fix landed first so we can actually debug properly again
2 parents 38916c7 + 81e3774 commit 4f6c48b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler/rustc_query_impl/src/plumbing.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ macro_rules! define_queries {
531531
key: queries::$name::Key<'tcx>,
532532
mode: QueryMode,
533533
) -> Option<Erase<queries::$name::Value<'tcx>>> {
534+
#[cfg(debug_assertions)]
535+
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
534536
get_query_incr(
535537
QueryType::config(tcx),
536538
QueryCtxt::new(tcx),
@@ -571,10 +573,16 @@ macro_rules! define_queries {
571573
cache_on_disk: |tcx, key| ::rustc_middle::query::cached::$name(tcx, key),
572574
execute_query: |tcx, key| erase(tcx.$name(key)),
573575
compute: |tcx, key| {
576+
#[cfg(debug_assertions)]
577+
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
574578
__rust_begin_short_backtrace(||
575579
queries::$name::provided_to_erased(
576580
tcx,
577-
call_provider!([$($modifiers)*][tcx, $name, key])
581+
{
582+
let ret = call_provider!([$($modifiers)*][tcx, $name, key]);
583+
tracing::trace!(?ret);
584+
ret
585+
}
578586
)
579587
)
580588
},

0 commit comments

Comments
 (0)