From 36279f1b631c345d22111809536edf70522d256e Mon Sep 17 00:00:00 2001 From: Alex Macleod Date: Thu, 13 Jul 2023 20:06:12 +0000 Subject: [PATCH] Trigger a rebuild when CLIPPY_CONF_DIR changes --- src/driver.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/driver.rs b/src/driver.rs index 1eb288b153a5..ee17feed77a0 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -130,6 +130,13 @@ impl rustc_driver::Callbacks for ClippyCallbacks { config.parse_sess_created = Some(Box::new(move |parse_sess| { track_clippy_args(parse_sess, &clippy_args_var); track_files(parse_sess); + + // Trigger a rebuild if CLIPPY_CONF_DIR changes. The value must be a valid string so + // changes between dirs that are invalid UTF-8 will not trigger rebuilds + parse_sess.env_depinfo.get_mut().insert(( + Symbol::intern("CLIPPY_CONF_DIR"), + env::var("CLIPPY_CONF_DIR").ok().map(|dir| Symbol::intern(&dir)), + )); })); config.register_lints = Some(Box::new(move |sess, lint_store| { // technically we're ~guaranteed that this is none but might as well call anything that