@@ -52,39 +52,26 @@ use crate::utils::execution_context::ExecutionContext;
5252use crate :: utils:: helpers:: exe;
5353use crate :: { GitInfo , OnceLock , TargetSelection , check_ci_llvm, helpers, t} ;
5454
55- /// Each path from this function is considered "allowed" in the `download-rustc="if-unchanged"` logic.
55+ /// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic.
5656/// This means they can be modified and changes to these paths should never trigger a compiler build
5757/// when "if-unchanged" is set.
58- pub fn rustc_if_unchanged_allowed_paths ( ) -> Vec < & ' static str > {
59- // NOTE: Paths must have the ":!" prefix to tell git to ignore changes in those paths during
60- // the diff check.
61- //
62- // WARNING: Be cautious when adding paths to this list. If a path that influences the compiler build
63- // is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results.
64- // For example, "src/bootstrap" should never be included in this list as it plays a crucial role in the
65- // final output/compiler, which can be significantly affected by changes made to the bootstrap sources.
66- let mut paths = vec ! [
67- ":!library" ,
68- ":!src/tools" ,
69- ":!src/librustdoc" ,
70- ":!src/rustdoc-json-types" ,
71- ":!tests" ,
72- ":!triagebot.toml" ,
73- ] ;
74-
75- if !CiEnv :: is_ci ( ) {
76- // When a dependency is added/updated/removed in the library tree (or in some tools),
77- // `Cargo.lock` will be updated by `cargo`. This update will incorrectly invalidate the
78- // `download-rustc=if-unchanged` cache.
79- //
80- // To prevent this, add `Cargo.lock` to the list of allowed paths when not running on CI.
81- // This is generally safe because changes to dependencies typically involve modifying
82- // `Cargo.toml`, which would already invalidate the CI-rustc cache on non-allowed paths.
83- paths. push ( ":!Cargo.lock" ) ;
84- }
85-
86- paths
87- }
58+ ///
59+ /// NOTE: Paths must have the ":!" prefix to tell git to ignore changes in those paths during
60+ /// the diff check.
61+ ///
62+ /// WARNING: Be cautious when adding paths to this list. If a path that influences the compiler build
63+ /// is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results.
64+ /// For example, "src/bootstrap" should never be included in this list as it plays a crucial role in the
65+ /// final output/compiler, which can be significantly affected by changes made to the bootstrap sources.
66+ #[ rustfmt:: skip] // We don't want rustfmt to oneline this list
67+ pub const RUSTC_IF_UNCHANGED_ALLOWED_PATHS : & [ & str ] = & [
68+ ":!library" ,
69+ ":!src/tools" ,
70+ ":!src/librustdoc" ,
71+ ":!src/rustdoc-json-types" ,
72+ ":!tests" ,
73+ ":!triagebot.toml" ,
74+ ] ;
8875
8976/// Global configuration for the entire build and/or bootstrap.
9077///
@@ -1516,7 +1503,7 @@ impl Config {
15161503 let commit = if self . rust_info . is_managed_git_subrepository ( ) {
15171504 // Look for a version to compare to based on the current commit.
15181505 // Only commits merged by bors will have CI artifacts.
1519- let freshness = self . check_path_modifications ( & rustc_if_unchanged_allowed_paths ( ) ) ;
1506+ let freshness = self . check_path_modifications ( RUSTC_IF_UNCHANGED_ALLOWED_PATHS ) ;
15201507 self . verbose ( || {
15211508 eprintln ! ( "rustc freshness: {freshness:?}" ) ;
15221509 } ) ;
0 commit comments