Skip to content

Commit 9f355a3

Browse files
committed
bootstrap: Inhibit download-rustc in CI when tools are changed
1 parent 15c643c commit 9f355a3

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/bootstrap/src/core/builder/tests.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,27 @@ fn ci_rustc_if_unchanged_do_not_invalidate_on_library_changes_outside_ci() {
281281
}
282282

283283
#[test]
284-
fn ci_rustc_if_unchanged_do_not_invalidate_on_tool_changes() {
284+
fn ci_rustc_if_unchanged_do_not_invalidate_on_tool_changes_in_ci() {
285285
git_test(|ctx| {
286286
prepare_rustc_checkout(ctx);
287287
let sha = ctx.create_upstream_merge(&["compiler/bar"]);
288-
// This change should not invalidate download-ci-rustc
288+
// This change should invalidate download-ci-rustc
289289
ctx.create_nonupstream_merge(&["src/tools/foo"]);
290290

291291
let config = parse_config_download_rustc_at(ctx.get_path(), "if-unchanged", true);
292+
assert_eq!(config.download_rustc_commit, None);
293+
});
294+
}
295+
296+
#[test]
297+
fn ci_rustc_if_unchanged_do_not_invalidate_on_tool_changes_outside_ci() {
298+
git_test(|ctx| {
299+
prepare_rustc_checkout(ctx);
300+
let sha = ctx.create_upstream_merge(&["compiler/bar"]);
301+
// This change should not invalidate download-ci-rustc
302+
ctx.create_nonupstream_merge(&["src/tools/foo"]);
303+
304+
let config = parse_config_download_rustc_at(ctx.get_path(), "if-unchanged", false);
292305
assert_eq!(config.download_rustc_commit, Some(sha));
293306
});
294307
}

src/bootstrap/src/core/config/config.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ use crate::utils::helpers::{self, exe, output, t};
4343
/// is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results.
4444
/// For example, "src/bootstrap" should never be included in this list as it plays a crucial role in the
4545
/// final output/compiler, which can be significantly affected by changes made to the bootstrap sources.
46-
#[rustfmt::skip] // We don't want rustfmt to oneline this list
4746
pub(crate) const RUSTC_IF_UNCHANGED_ALLOWED_PATHS: &[&str] = &[
48-
":!src/tools",
47+
// tidy-alphabetical-start
4948
":!src/librustdoc",
5049
":!src/rustdoc-json-types",
5150
":!tests",
5251
":!triagebot.toml",
52+
// tidy-alphabetical-end
5353
];
5454

5555
/// Additional "allowed" paths for the `download-rustc="if-unchanged"` logic
@@ -64,6 +64,10 @@ const RUSTC_IF_UNCHANGED_EXTRA_ALLOWED_PATHS_OUTSIDE_CI: &[&str] = &[
6464
// functionality for library developers between `download-rustc=true` and `download-rustc="if-unchanged"`
6565
// options.
6666
":!library",
67+
// Tool changes should inhibit download-rustc in CI, to avoid situations like
68+
// <https://github.com/rust-lang/rust/pull/139998#issuecomment-2824674661>
69+
// where download-rustc interferes with test metrics for delicate compiletest changes.
70+
":!src/tools",
6771
// tidy-alphabetical-end
6872
];
6973

0 commit comments

Comments
 (0)