From 219603a958f2deafd961e746b5ec963c11c44823 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 20 Mar 2021 02:14:04 +0100 Subject: [PATCH] Only enable assert_dep_graph when query-dep-graph is enabled. --- compiler/rustc_incremental/src/assert_dep_graph.rs | 4 ++++ compiler/rustc_incremental/src/persist/dirty_clean.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/compiler/rustc_incremental/src/assert_dep_graph.rs b/compiler/rustc_incremental/src/assert_dep_graph.rs index f1f69f1510b..a080b0ce339 100644 --- a/compiler/rustc_incremental/src/assert_dep_graph.rs +++ b/compiler/rustc_incremental/src/assert_dep_graph.rs @@ -57,6 +57,10 @@ pub fn assert_dep_graph(tcx: TyCtxt<'_>) { dump_graph(tcx); } + if !tcx.sess.opts.debugging_opts.query_dep_graph { + return; + } + // if the `rustc_attrs` feature is not enabled, then the // attributes we are interested in cannot be present anyway, so // skip the walk. diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index 0b544b8ab41..cb089a728ee 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -148,6 +148,10 @@ impl Assertion { } pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) { + if !tcx.sess.opts.debugging_opts.query_dep_graph { + return; + } + // can't add `#[rustc_dirty]` etc without opting in to this feature if !tcx.features().rustc_attrs { return;