From 7469dda09f7a09effa56ec49b4e56d7ba86b5c5e Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 14 Nov 2023 13:45:03 +1100 Subject: [PATCH] Remove `Config::hash_untracked_state`. The doc comment claims that Clippy uses it, but that's not true. Nothing in the repo uses it. --- compiler/rustc_driver_impl/src/lib.rs | 1 - compiler/rustc_interface/src/interface.rs | 13 ------------- compiler/rustc_session/src/config.rs | 2 -- compiler/rustc_session/src/options.rs | 5 ----- src/librustdoc/core.rs | 1 - src/librustdoc/doctest.rs | 1 - tests/run-make-fulldeps/issue-19371/foo.rs | 1 - 7 files changed, 24 deletions(-) diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 84ae45d6a2b6f..0918d06844f92 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -329,7 +329,6 @@ fn run_compiler( locale_resources: DEFAULT_LOCALE_RESOURCES, lint_caps: Default::default(), parse_sess_created: None, - hash_untracked_state: None, register_lints: None, override_queries: None, make_codegen_backend, diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index c4962707f69a8..144d9077a3bdc 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -5,7 +5,6 @@ use rustc_ast::{self as ast, LitKind, MetaItemKind}; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::defer; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::Lrc; use rustc_errors::registry::Registry; use rustc_errors::{ErrorGuaranteed, Handler}; @@ -347,12 +346,6 @@ pub struct Config { /// This is a callback from the driver that is called when [`ParseSess`] is created. pub parse_sess_created: Option>, - /// This is a callback to hash otherwise untracked state used by the caller, if the - /// hash changes between runs the incremental cache will be cleared. - /// - /// e.g. used by Clippy to hash its config file - pub hash_untracked_state: Option>, - /// This is a callback from the driver that is called when we're registering lints; /// it is called during lint loading when we have the LintStore in a non-shared state. /// @@ -467,12 +460,6 @@ pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Se parse_sess_created(&mut sess.parse_sess); } - if let Some(hash_untracked_state) = config.hash_untracked_state { - let mut hasher = StableHasher::new(); - hash_untracked_state(&sess, &mut hasher); - sess.opts.untracked_state_hash = hasher.finish() - } - let compiler = Compiler { sess: Lrc::new(sess), codegen_backend: Lrc::from(codegen_backend), diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index add40b83d21d3..e311051e6acb9 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1090,7 +1090,6 @@ impl Default for Options { target_triple: TargetTriple::from_triple(host_triple()), test: false, incremental: None, - untracked_state_hash: Default::default(), unstable_opts: Default::default(), prints: Vec::new(), cg: Default::default(), @@ -2880,7 +2879,6 @@ pub fn build_session_options( target_triple, test, incremental, - untracked_state_hash: Default::default(), unstable_opts, prints, cg, diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 76d69646f1df7..73900461d7906 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -4,7 +4,6 @@ use crate::search_paths::SearchPath; use crate::utils::NativeLib; use crate::{lint, EarlyErrorHandler}; use rustc_data_structures::profiling::TimePassesFormat; -use rustc_data_structures::stable_hasher::Hash64; use rustc_errors::ColorConfig; use rustc_errors::{LanguageIdentifier, TerminalUrl}; use rustc_target::spec::{CodeModel, LinkerFlavorCli, MergeFunctions, PanicStrategy, SanitizerSet}; @@ -158,10 +157,6 @@ top_level_options!( /// directory to store intermediate results. incremental: Option [UNTRACKED], assert_incr_state: Option [UNTRACKED], - /// Set by the `Config::hash_untracked_state` callback for custom - /// drivers to invalidate the incremental cache - #[rustc_lint_opt_deny_field_access("should only be used via `Config::hash_untracked_state`")] - untracked_state_hash: Hash64 [TRACKED_NO_CRATE_HASH], unstable_opts: UnstableOptions [SUBSTRUCT], prints: Vec [UNTRACKED], diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 6d9f8b820c485..e5c8e8a9943d9 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -263,7 +263,6 @@ pub(crate) fn create_config( locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES, lint_caps, parse_sess_created: None, - hash_untracked_state: None, register_lints: Some(Box::new(crate::lint::register_lints)), override_queries: Some(|_sess, providers| { // We do not register late module lints, so this only runs `MissingDoc`. diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 2412865801d6d..86857c946a1ce 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -99,7 +99,6 @@ pub(crate) fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> { locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES, lint_caps, parse_sess_created: None, - hash_untracked_state: None, register_lints: Some(Box::new(crate::lint::register_lints)), override_queries: None, make_codegen_backend: None, diff --git a/tests/run-make-fulldeps/issue-19371/foo.rs b/tests/run-make-fulldeps/issue-19371/foo.rs index 1a94649163b2b..a0087680bb918 100644 --- a/tests/run-make-fulldeps/issue-19371/foo.rs +++ b/tests/run-make-fulldeps/issue-19371/foo.rs @@ -57,7 +57,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) { locale_resources: &[], lint_caps: Default::default(), parse_sess_created: None, - hash_untracked_state: None, register_lints: None, override_queries: None, make_codegen_backend: None,