diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-06-21 15:45:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-21 15:45:17 +0200 |
| commit | 4f6c48b61bd2e855fa4f63038297e832104445ec (patch) | |
| tree | b12824ec845f46e0e0ee23efa0728425f7e767de | |
| parent | 38916c71cb2528ff2a624f8485dda49a30a6e3d0 (diff) | |
| parent | 81e37743a506b2cf0aff1bb6c0cdd3d22699776f (diff) | |
| download | rust-4f6c48b61bd2e855fa4f63038297e832104445ec.tar.gz rust-4f6c48b61bd2e855fa4f63038297e832104445ec.zip | |
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 https://github.com/rust-lang/rust/pull/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
| -rw-r--r-- | compiler/rustc_query_impl/src/plumbing.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 244f0e84b43..cb0df1d1b82 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -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), @@ -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 + } ) ) }, |
