Skip to content

Commit 0d5a738

Browse files
committed
Enable tracing for all queryies
1 parent 9add632 commit 0d5a738

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4244,6 +4244,7 @@ dependencies = [
42444244
"rustc_serialize",
42454245
"rustc_session",
42464246
"rustc_span",
4247+
"tracing",
42474248
]
42484249

42494250
[[package]]

compiler/rustc_query_impl/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ rustc_query_system = { path = "../rustc_query_system" }
2020
rustc_serialize = { path = "../rustc_serialize" }
2121
rustc_session = { path = "../rustc_session" }
2222
rustc_span = { path = "../rustc_span" }
23+
tracing = "0.1"
2324

2425
[features]
2526
rustc_use_parallel_compiler = ["rustc-rayon-core", "rustc_query_system/rustc_use_parallel_compiler"]

compiler/rustc_query_impl/src/plumbing.rs

+3
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ macro_rules! define_queries {
435435

436436
fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: DepNode) -> bool {
437437
if let Some(key) = recover(tcx, dep_node) {
438+
#[cfg(debug_assertions)]
439+
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
438440
let tcx = QueryCtxt::from_tcx(tcx);
439441
force_query::<queries::$name<'_>, _>(tcx, key, dep_node);
440442
true
@@ -532,6 +534,7 @@ macro_rules! define_queries_struct {
532534

533535
$($(#[$attr])*
534536
#[inline(always)]
537+
#[tracing::instrument(level = "trace", skip(self, tcx))]
535538
fn $name(
536539
&'tcx self,
537540
tcx: TyCtxt<$tcx>,

compiler/rustc_query_system/src/query/plumbing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ where
675675
}
676676
}
677677

678+
#[derive(Debug)]
678679
pub enum QueryMode {
679680
Get,
680681
Ensure,
@@ -697,7 +698,6 @@ where
697698
None
698699
};
699700

700-
debug!("ty::query::get_query<{}>(key={:?}, span={:?})", Q::NAME, key, span);
701701
let (result, dep_node_index) = try_execute_query(
702702
tcx,
703703
Q::query_state(tcx),

0 commit comments

Comments
 (0)