Skip to content

Commit 9f10635

Browse files
committed
Make download-rustc incompatible with rust.debug-assertions for now
Alt rustc builds currently do not have rustc debug assertions enabled.
1 parent 4d18ea5 commit 9f10635

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

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

+23
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,29 @@ impl Config {
17671767
std_features: std_features_toml,
17681768
} = rust;
17691769

1770+
// Before something like [Enable debug assertions on alt
1771+
// builds](https://github.com/rust-lang/rust/pull/131077) lands, alt rustc builds do
1772+
// *not* have rustc debug assertions enabled. We must not download an CI alt rustc if we
1773+
// need rustc to have debug assertions (e.g. for crashes test suite).
1774+
//
1775+
// Note that `rust.debug = true` (currently) implies `rust.debug-assertions = true`!
1776+
//
1777+
// This relies also on the fact that global default for `download-rustc` will be `false`
1778+
// if it's not explicitly set.
1779+
if matches!(rustc_debug_assertions, Some(true))
1780+
|| (matches!(debug, Some(true)) && rustc_debug_assertions.is_none())
1781+
{
1782+
if let Some(ref opt) = download_rustc {
1783+
if opt.is_string_or_true() {
1784+
panic!(
1785+
"ERROR: currently no CI rustc builds have rustc debug assertions\
1786+
enabled. Please either set `rust.debug-assertions` to `false` or set \
1787+
`rust.download-rustc` to `false`."
1788+
);
1789+
}
1790+
}
1791+
}
1792+
17701793
config.download_rustc_commit =
17711794
config.download_ci_rustc_commit(download_rustc, config.llvm_assertions);
17721795

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

+65
Original file line numberDiff line numberDiff line change
@@ -447,3 +447,68 @@ fn check_rustc_if_unchanged_paths() {
447447
assert!(config.src.join(p).exists(), "{p} doesn't exist.");
448448
}
449449
}
450+
451+
#[test]
452+
#[should_panic]
453+
fn download_rustc_xor_rustc_debug_assertions_both_true() {
454+
parse(
455+
r#"
456+
[rust]
457+
debug-assertions = true
458+
download-rustc = true
459+
"#,
460+
);
461+
}
462+
463+
#[test]
464+
#[should_panic]
465+
fn download_rustc_xor_rustc_debug_assertions_debug_download_unchanged() {
466+
parse(
467+
r#"
468+
[rust]
469+
debug-assertions = true
470+
download-rustc = 'if-unchanged'
471+
"#,
472+
);
473+
}
474+
475+
#[test]
476+
#[should_panic]
477+
fn download_rustc_xor_rustc_debug_assertions_debug_true() {
478+
parse(
479+
r#"
480+
[rust]
481+
debug = true
482+
download-rustc = true
483+
"#,
484+
);
485+
}
486+
487+
#[test]
488+
fn download_rustc_xor_rustc_debug_assertions_only_download_rustc() {
489+
let _ = parse(
490+
r#"
491+
[rust]
492+
download-rustc = true
493+
"#,
494+
);
495+
496+
let _ = parse(
497+
r#"
498+
[rust]
499+
download-rustc = 'if-unchanged'
500+
"#,
501+
);
502+
}
503+
504+
#[test]
505+
fn download_rustc_xor_rustc_debug_assertions_no_debug_assert_ok() {
506+
let _ = parse(
507+
r#"
508+
[rust]
509+
debug = true
510+
debug-assertions = false
511+
download-rustc = true
512+
"#,
513+
);
514+
}

src/bootstrap/src/utils/change_tracker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,6 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
303303
ChangeInfo {
304304
change_id: 133068,
305305
severity: ChangeSeverity::Info,
306-
summary: "Reverted `download-rustc` defaults; global default is now `false`, and only use `'if-unchanged'` default for library and tools profile.",
306+
summary: "Reverted `download-rustc` defaults; global default is now `false`, and only use `'if-unchanged'` default for library and tools profile. Also fixed that `rust.debug-assertions = true` is incompatible with `rust.download-rustc = true | 'if-unchanged'`",
307307
},
308308
];

0 commit comments

Comments
 (0)