@@ -28,6 +28,53 @@ use crate::utils::cache::{INTERNER, Interned};
2828use crate :: utils:: channel:: { self , GitInfo } ;
2929use crate :: utils:: helpers:: { self , exe, output, t} ;
3030
31+ /// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic.
32+ /// This means they can be modified and changes to these paths should never trigger a compiler build
33+ /// when "if-unchanged" is set.
34+ ///
35+ /// NOTE: Paths must have the ":!" prefix to tell git to ignore changes in those paths during
36+ /// the diff check.
37+ ///
38+ /// WARNING: Be cautious when adding paths to this list. If a path that influences the compiler build
39+ /// is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results.
40+ const RUSTC_IF_UNCHANGED_ALLOWED_PATHS : & [ & str ] = & [
41+ ":!.clang-format" ,
42+ ":!.editorconfig" ,
43+ ":!.git-blame-ignore-revs" ,
44+ ":!.gitattributes" ,
45+ ":!.gitignore" ,
46+ ":!.gitmodules" ,
47+ ":!.ignore" ,
48+ ":!.mailmap" ,
49+ ":!CODE_OF_CONDUCT.md" ,
50+ ":!CONTRIBUTING.md" ,
51+ ":!COPYRIGHT" ,
52+ ":!INSTALL.md" ,
53+ ":!LICENSE-APACHE" ,
54+ ":!LICENSE-MIT" ,
55+ ":!LICENSES" ,
56+ ":!README.md" ,
57+ ":!RELEASES.md" ,
58+ ":!REUSE.toml" ,
59+ ":!config.example.toml" ,
60+ ":!configure" ,
61+ ":!rust-bors.toml" ,
62+ ":!rustfmt.toml" ,
63+ ":!tests" ,
64+ ":!triagebot.toml" ,
65+ ":!x" ,
66+ ":!x.ps1" ,
67+ ":!x.py" ,
68+ ":!src/ci/cpu-usage-over-time.py" ,
69+ ":!src/ci/publish_toolstate.sh" ,
70+ ":!src/doc" ,
71+ ":!src/etc" ,
72+ ":!src/librustdoc" ,
73+ ":!src/rustdoc-json-types" ,
74+ ":!src/tools" ,
75+ ":!src/README.md" ,
76+ ] ;
77+
3178macro_rules! check_ci_llvm {
3279 ( $name: expr) => {
3380 assert!(
@@ -2767,13 +2814,13 @@ impl Config {
27672814 }
27682815 } ;
27692816
2770- let files_to_track =
2771- & [ "compiler" , "library" , "src/version" , "src/stage0" , "src/ci/channel" ] ;
2772-
27732817 // Look for a version to compare to based on the current commit.
27742818 // Only commits merged by bors will have CI artifacts.
2775- let commit = match self . last_modified_commit ( files_to_track, "download-rustc" , if_unchanged)
2776- {
2819+ let commit = match self . last_modified_commit (
2820+ RUSTC_IF_UNCHANGED_ALLOWED_PATHS ,
2821+ "download-rustc" ,
2822+ if_unchanged,
2823+ ) {
27772824 Some ( commit) => commit,
27782825 None => {
27792826 if if_unchanged {
0 commit comments