Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions compiler/rustc_interface/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use rustc_ast::{LitKind, MetaItemKind, token};
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::jobserver::{self, Proxy};
use rustc_data_structures::stable_hasher::StableHasher;
use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed};
use rustc_lint::LintStore;
use rustc_middle::ty;
Expand Down Expand Up @@ -339,11 +338,7 @@ pub struct Config {
/// This is a callback to track otherwise untracked state used by the caller.
///
/// You can write to `sess.env_depinfo` and `sess.file_depinfo` to track env vars and files.
/// To track any other state you can write to the given hasher. If the hash changes between
/// runs the incremental cache will be cleared.
///
/// The hashing functionality has no known user. FIXME should this be removed?
pub track_state: Option<Box<dyn FnOnce(&Session, &mut StableHasher) + Send>>,
pub track_state: Option<Box<dyn FnOnce(&Session) + Send>>,

/// 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.
Expand Down Expand Up @@ -468,9 +463,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
}

if let Some(track_state) = config.track_state {
let mut hasher = StableHasher::new();
track_state(&sess, &mut hasher);
sess.opts.untracked_state_hash = hasher.finish()
track_state(&sess);
}

// Even though the session holds the lint store, we can't build the
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,6 @@ impl Default for Options {
target_triple: TargetTuple::from_tuple(host_tuple()),
test: false,
incremental: None,
untracked_state_hash: Default::default(),
unstable_opts,
prints: Vec::new(),
cg: Default::default(),
Expand Down Expand Up @@ -2770,7 +2769,6 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
target_triple,
test,
incremental,
untracked_state_hash: Default::default(),
unstable_opts,
prints,
cg,
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ top_level_options!(
/// If `Some`, enable incremental compilation, using the given
/// directory to store intermediate results.
incremental: Option<PathBuf> [UNTRACKED],
/// Set based on the result of the `Config::track_state` callback
/// for custom drivers to invalidate the incremental cache.
#[rustc_lint_opt_deny_field_access("should only be used via `Config::track_state`")]
untracked_state_hash: Hash64 [TRACKED_NO_CRATE_HASH],

unstable_opts: UnstableOptions [SUBSTRUCT] { TARGET_MODIFIER: UnstableOptions(UnstableOptionsTargetModifiers) },
prints: Vec<PrintRequest> [UNTRACKED],
Expand Down
4 changes: 2 additions & 2 deletions src/doc/rustc-dev-guide/examples/rustc-interface-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn main() {
make_codegen_backend: None,
expanded_args: Vec::new(),
ice_file: None,
hash_untracked_state: None,
track_state: None,
using_internal_features: &rustc_driver::USING_INTERNAL_FEATURES,
};
rustc_interface::run_compiler(config, |compiler| {
Expand All @@ -72,4 +72,4 @@ fn main() {
}
});
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn main() {
make_codegen_backend: None,
expanded_args: Vec::new(),
ice_file: None,
hash_untracked_state: None,
track_state: None,
using_internal_features: &rustc_driver::USING_INTERNAL_FEATURES,
};
rustc_interface::run_compiler(config, |compiler| {
Expand All @@ -97,4 +97,4 @@ fn main() {
buffer.lock().unwrap().iter().for_each(|diagnostic| {
println!("{diagnostic:#?}");
});
}
}
4 changes: 2 additions & 2 deletions src/tools/clippy/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ struct RustcCallbacks {
impl rustc_driver::Callbacks for RustcCallbacks {
fn config(&mut self, config: &mut interface::Config) {
let clippy_args_var = self.clippy_args_var.take();
config.track_state = Some(Box::new(move |sess, _hasher| {
config.track_state = Some(Box::new(move |sess| {
track_clippy_args(sess, clippy_args_var.as_deref());
}));
config.extra_symbols = sym::EXTRA_SYMBOLS.into();
Expand All @@ -138,7 +138,7 @@ impl rustc_driver::Callbacks for ClippyCallbacks {
let conf_path = clippy_config::lookup_conf_file();
let previous = config.register_lints.take();
let clippy_args_var = self.clippy_args_var.take();
config.track_state = Some(Box::new(move |sess, _hasher| {
config.track_state = Some(Box::new(move |sess| {
track_clippy_args(sess, clippy_args_var.as_deref());
track_files(sess);

Expand Down
Loading