From 0d5a738b8b715024c25c4ad973399f2e81b7577b Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 4 May 2022 08:30:13 +0000 Subject: [PATCH] Enable tracing for all queryies --- Cargo.lock | 1 + compiler/rustc_query_impl/Cargo.toml | 1 + compiler/rustc_query_impl/src/plumbing.rs | 3 +++ compiler/rustc_query_system/src/query/plumbing.rs | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 94832a24409..a5ce26894b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4244,6 +4244,7 @@ dependencies = [ "rustc_serialize", "rustc_session", "rustc_span", + "tracing", ] [[package]] diff --git a/compiler/rustc_query_impl/Cargo.toml b/compiler/rustc_query_impl/Cargo.toml index b7502c4b1e2..fa05434e48b 100644 --- a/compiler/rustc_query_impl/Cargo.toml +++ b/compiler/rustc_query_impl/Cargo.toml @@ -20,6 +20,7 @@ rustc_query_system = { path = "../rustc_query_system" } rustc_serialize = { path = "../rustc_serialize" } rustc_session = { path = "../rustc_session" } rustc_span = { path = "../rustc_span" } +tracing = "0.1" [features] rustc_use_parallel_compiler = ["rustc-rayon-core", "rustc_query_system/rustc_use_parallel_compiler"] diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index bc82b0053b9..ae4ad428159 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -435,6 +435,8 @@ macro_rules! define_queries { fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: DepNode) -> bool { if let Some(key) = recover(tcx, dep_node) { + #[cfg(debug_assertions)] + let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered(); let tcx = QueryCtxt::from_tcx(tcx); force_query::, _>(tcx, key, dep_node); true @@ -532,6 +534,7 @@ macro_rules! define_queries_struct { $($(#[$attr])* #[inline(always)] + #[tracing::instrument(level = "trace", skip(self, tcx))] fn $name( &'tcx self, tcx: TyCtxt<$tcx>, diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 700290d67a4..3498df95196 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -675,6 +675,7 @@ where } } +#[derive(Debug)] pub enum QueryMode { Get, Ensure, @@ -697,7 +698,6 @@ where None }; - debug!("ty::query::get_query<{}>(key={:?}, span={:?})", Q::NAME, key, span); let (result, dep_node_index) = try_execute_query( tcx, Q::query_state(tcx),