diff options
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/tests.rs | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index bb1c7219eda..b4bea7a68de 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -37,7 +37,7 @@ use crate::utils::helpers::{self, exe, output, t}; /// /// WARNING: Be cautious when adding paths to this list. If a path that influences the compiler build /// is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results. -const RUSTC_IF_UNCHANGED_ALLOWED_PATHS: &[&str] = &[ +pub(crate) const RUSTC_IF_UNCHANGED_ALLOWED_PATHS: &[&str] = &[ ":!.clang-format", ":!.editorconfig", ":!.git-blame-ignore-revs", diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index 1f02757682c..7e4eca3c5b0 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -8,7 +8,7 @@ use clap::CommandFactory; use serde::Deserialize; use super::flags::Flags; -use super::{ChangeIdWrapper, Config}; +use super::{ChangeIdWrapper, Config, RUSTC_IF_UNCHANGED_ALLOWED_PATHS}; use crate::core::build_steps::clippy::get_clippy_rules_in_order; use crate::core::build_steps::llvm; use crate::core::config::{LldMode, Target, TargetSelection, TomlConfig}; @@ -410,3 +410,18 @@ fn jobs_precedence() { ); assert_eq!(config.jobs, Some(123)); } + +#[test] +fn check_rustc_if_unchanged_paths() { + let config = parse(""); + let normalised_allowed_paths: Vec<_> = RUSTC_IF_UNCHANGED_ALLOWED_PATHS + .iter() + .map(|t| { + t.strip_prefix(":!").expect(&format!("{t} doesn't have ':!' prefix, but it should.")) + }) + .collect(); + + for p in normalised_allowed_paths { + assert!(config.src.join(p).exists(), "{p} doesn't exist."); + } +} |
