@@ -33,7 +33,7 @@ macro_rules! check_ci_llvm {
33
33
assert!(
34
34
$name. is_none( ) ,
35
35
"setting {} is incompatible with download-ci-llvm." ,
36
- stringify!( $name)
36
+ stringify!( $name) . replace ( "_" , "-" )
37
37
) ;
38
38
} ;
39
39
}
@@ -1568,7 +1568,15 @@ impl Config {
1568
1568
let mut lld_enabled = None ;
1569
1569
1570
1570
let mut is_user_configured_rust_channel = false ;
1571
+
1571
1572
if let Some ( rust) = toml. rust {
1573
+ config. download_rustc_commit =
1574
+ config. download_ci_rustc_commit ( rust. download_rustc . clone ( ) ) ;
1575
+
1576
+ if config. download_rustc_commit . is_some ( ) {
1577
+ check_incompatible_options_for_ci_rustc ( & rust) ;
1578
+ }
1579
+
1572
1580
let Rust {
1573
1581
optimize : optimize_toml,
1574
1582
debug : debug_toml,
@@ -1616,7 +1624,7 @@ impl Config {
1616
1624
new_symbol_mangling,
1617
1625
profile_generate,
1618
1626
profile_use,
1619
- download_rustc,
1627
+ download_rustc : _ ,
1620
1628
lto,
1621
1629
validate_mir_opts,
1622
1630
frame_pointers,
@@ -1626,11 +1634,7 @@ impl Config {
1626
1634
} = rust;
1627
1635
1628
1636
is_user_configured_rust_channel = channel. is_some ( ) ;
1629
- set ( & mut config. channel , channel) ;
1630
-
1631
- config. download_rustc_commit = config. download_ci_rustc_commit ( download_rustc) ;
1632
-
1633
- // FIXME: handle download-rustc incompatible options.
1637
+ set ( & mut config. channel , channel. clone ( ) ) ;
1634
1638
1635
1639
debug = debug_toml;
1636
1640
debug_assertions = debug_assertions_toml;
@@ -2608,6 +2612,113 @@ impl Config {
2608
2612
}
2609
2613
}
2610
2614
2615
+ /// Checks the CI rustc incompatible options by destructuring the `Rust` instance
2616
+ /// and makes sure that no rust options from config.toml are missed.
2617
+ fn check_incompatible_options_for_ci_rustc ( rust : & Rust ) {
2618
+ macro_rules! err {
2619
+ ( $name: expr) => {
2620
+ assert!(
2621
+ $name. is_none( ) ,
2622
+ "ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`." ,
2623
+ stringify!( $name) . replace( "_" , "-" )
2624
+ ) ;
2625
+ } ;
2626
+ }
2627
+
2628
+ macro_rules! warn {
2629
+ ( $name: expr) => {
2630
+ if $name. is_some( ) {
2631
+ println!(
2632
+ "WARNING: `rust.{}` has no effect with `rust.download-rustc`." ,
2633
+ stringify!( $name) . replace( "_" , "-" )
2634
+ ) ;
2635
+ }
2636
+ } ;
2637
+ }
2638
+
2639
+ let Rust {
2640
+ // Following options are the CI rustc incompatible ones.
2641
+ optimize,
2642
+ debug_logging,
2643
+ debuginfo_level_rustc,
2644
+ llvm_tools,
2645
+ llvm_bitcode_linker,
2646
+ lto,
2647
+ stack_protector,
2648
+ strip,
2649
+ lld_mode,
2650
+ jemalloc,
2651
+ rpath,
2652
+ channel,
2653
+ description,
2654
+ incremental,
2655
+ default_linker,
2656
+
2657
+ // Rest of the options can simply be ignored.
2658
+ debug : _,
2659
+ codegen_units : _,
2660
+ codegen_units_std : _,
2661
+ debug_assertions : _,
2662
+ debug_assertions_std : _,
2663
+ overflow_checks : _,
2664
+ overflow_checks_std : _,
2665
+ debuginfo_level : _,
2666
+ debuginfo_level_std : _,
2667
+ debuginfo_level_tools : _,
2668
+ debuginfo_level_tests : _,
2669
+ split_debuginfo : _,
2670
+ backtrace : _,
2671
+ parallel_compiler : _,
2672
+ musl_root : _,
2673
+ verbose_tests : _,
2674
+ optimize_tests : _,
2675
+ codegen_tests : _,
2676
+ omit_git_hash : _,
2677
+ dist_src : _,
2678
+ save_toolstates : _,
2679
+ codegen_backends : _,
2680
+ lld : _,
2681
+ deny_warnings : _,
2682
+ backtrace_on_ice : _,
2683
+ verify_llvm_ir : _,
2684
+ thin_lto_import_instr_limit : _,
2685
+ remap_debuginfo : _,
2686
+ test_compare_mode : _,
2687
+ llvm_libunwind : _,
2688
+ control_flow_guard : _,
2689
+ ehcont_guard : _,
2690
+ new_symbol_mangling : _,
2691
+ profile_generate : _,
2692
+ profile_use : _,
2693
+ download_rustc : _,
2694
+ validate_mir_opts : _,
2695
+ frame_pointers : _,
2696
+ } = rust;
2697
+
2698
+ // There are two kinds of checks for CI rustc incompatible options:
2699
+ // 1. Checking an option that may change the compiler behaviour/output.
2700
+ // 2. Checking an option that have no effect on the compiler behaviour/output.
2701
+ //
2702
+ // If the option belongs to the first category, we call `err` macro for a hard error;
2703
+ // otherwise, we just print a warning with `warn` macro.
2704
+ err ! ( optimize) ;
2705
+ err ! ( debug_logging) ;
2706
+ err ! ( debuginfo_level_rustc) ;
2707
+ err ! ( default_linker) ;
2708
+ err ! ( rpath) ;
2709
+ err ! ( strip) ;
2710
+ err ! ( stack_protector) ;
2711
+ err ! ( lld_mode) ;
2712
+ err ! ( llvm_tools) ;
2713
+ err ! ( llvm_bitcode_linker) ;
2714
+ err ! ( jemalloc) ;
2715
+ err ! ( lto) ;
2716
+
2717
+ warn ! ( channel) ;
2718
+ warn ! ( description) ;
2719
+ warn ! ( incremental) ;
2720
+ }
2721
+
2611
2722
fn set < T > ( field : & mut T , val : Option < T > ) {
2612
2723
if let Some ( v) = val {
2613
2724
* field = v;
0 commit comments