about summary refs log tree commit diff
path: root/compiler/rustc_interface
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-02 02:29:32 +0000
committerbors <bors@rust-lang.org>2022-02-02 02:29:32 +0000
commitd5f9c40e6a9ecc62432e71e886cef83a4c2c9b98 (patch)
tree81f0acd2ade399951a45b3b6ad98c15a2c9d9db7 /compiler/rustc_interface
parent1ea4851715893ee3f365a8ef09d47165e9a7864f (diff)
parent4e7d47bb6c91f6db5d043a152d11ab7528266d25 (diff)
downloadrust-d5f9c40e6a9ecc62432e71e886cef83a4c2c9b98.tar.gz
rust-d5f9c40e6a9ecc62432e71e886cef83a4c2c9b98.zip
Auto merge of #93466 - cjgillot:query-dead, r=nagisa
Make dead code check a query.

Dead code check is run for each invocation of the compiler, even if no modifications were involved.
This PR makes dead code check a query keyed on the module. This allows to skip the check when a module has not changed.
To perform this, a query `live_symbols_and_ignored_derived_traits` is introduced to encapsulate the global analysis of finding live symbols. The second query `check_mod_deathness` outputs diagnostics for each module based on this first query's results.
Diffstat (limited to 'compiler/rustc_interface')
-rw-r--r--compiler/rustc_interface/src/passes.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index be31eb89f1b..7a3d77466c5 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -999,7 +999,8 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
                         tcx.ensure().check_private_in_public(());
                     },
                     {
-                        sess.time("death_checking", || rustc_passes::dead::check_crate(tcx));
+                        tcx.hir()
+                            .par_for_each_module(|module| tcx.ensure().check_mod_deathness(module));
                     },
                     {
                         sess.time("unused_lib_feature_checking", || {