Skip to content

Commit

Permalink
Rollup merge of #112883 - oli-obk:tracing_queries, r=cjgillot
Browse files Browse the repository at this point in the history
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
  • Loading branch information
GuillaumeGomez authored Jun 21, 2023
2 parents 38916c7 + 81e3774 commit 4f6c48b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion compiler/rustc_query_impl/src/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ macro_rules! define_queries {
key: queries::$name::Key<'tcx>,
mode: QueryMode,
) -> Option<Erase<queries::$name::Value<'tcx>>> {
#[cfg(debug_assertions)]
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
get_query_incr(
QueryType::config(tcx),
QueryCtxt::new(tcx),
Expand Down Expand Up @@ -571,10 +573,16 @@ macro_rules! define_queries {
cache_on_disk: |tcx, key| ::rustc_middle::query::cached::$name(tcx, key),
execute_query: |tcx, key| erase(tcx.$name(key)),
compute: |tcx, key| {
#[cfg(debug_assertions)]
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
__rust_begin_short_backtrace(||
queries::$name::provided_to_erased(
tcx,
call_provider!([$($modifiers)*][tcx, $name, key])
{
let ret = call_provider!([$($modifiers)*][tcx, $name, key]);
tracing::trace!(?ret);
ret
}
)
)
},
Expand Down

0 comments on commit 4f6c48b

Please sign in to comment.