File tree 2 files changed +88
-0
lines changed
src/bootstrap/src/core/config
2 files changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -1767,6 +1767,29 @@ impl Config {
1767
1767
std_features : std_features_toml,
1768
1768
} = rust;
1769
1769
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
+
1770
1793
config. download_rustc_commit =
1771
1794
config. download_ci_rustc_commit ( download_rustc, config. llvm_assertions ) ;
1772
1795
Original file line number Diff line number Diff line change @@ -447,3 +447,68 @@ fn check_rustc_if_unchanged_paths() {
447
447
assert ! ( config. src. join( p) . exists( ) , "{p} doesn't exist." ) ;
448
448
}
449
449
}
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
+ }
You can’t perform that action at this time.
0 commit comments