@@ -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
}
@@ -1547,7 +1547,15 @@ impl Config {
1547
1547
let mut lld_enabled = None ;
1548
1548
1549
1549
let mut is_user_configured_rust_channel = false ;
1550
+
1550
1551
if let Some ( rust) = toml. rust {
1552
+ config. download_rustc_commit =
1553
+ config. download_ci_rustc_commit ( rust. download_rustc . clone ( ) ) ;
1554
+
1555
+ if config. download_rustc_commit . is_some ( ) {
1556
+ check_incompatible_options_for_ci_rustc ( & rust) ;
1557
+ }
1558
+
1551
1559
let Rust {
1552
1560
optimize : optimize_toml,
1553
1561
debug : debug_toml,
@@ -1595,7 +1603,7 @@ impl Config {
1595
1603
new_symbol_mangling,
1596
1604
profile_generate,
1597
1605
profile_use,
1598
- download_rustc,
1606
+ download_rustc : _ ,
1599
1607
lto,
1600
1608
validate_mir_opts,
1601
1609
frame_pointers,
@@ -1605,11 +1613,7 @@ impl Config {
1605
1613
} = rust;
1606
1614
1607
1615
is_user_configured_rust_channel = channel. is_some ( ) ;
1608
- set ( & mut config. channel , channel) ;
1609
-
1610
- config. download_rustc_commit = config. download_ci_rustc_commit ( download_rustc) ;
1611
-
1612
- // FIXME: handle download-rustc incompatible options.
1616
+ set ( & mut config. channel , channel. clone ( ) ) ;
1613
1617
1614
1618
debug = debug_toml;
1615
1619
debug_assertions = debug_assertions_toml;
@@ -2591,6 +2595,113 @@ impl Config {
2591
2595
}
2592
2596
}
2593
2597
2598
+ /// Checks the CI rustc incompatible options by destructuring the `Rust` instance
2599
+ /// and makes sure that no rust options from config.toml are missed.
2600
+ fn check_incompatible_options_for_ci_rustc ( rust : & Rust ) {
2601
+ macro_rules! err {
2602
+ ( $name: expr) => {
2603
+ assert!(
2604
+ $name. is_none( ) ,
2605
+ "ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`." ,
2606
+ stringify!( $name) . replace( "_" , "-" )
2607
+ ) ;
2608
+ } ;
2609
+ }
2610
+
2611
+ macro_rules! warn {
2612
+ ( $name: expr) => {
2613
+ if $name. is_some( ) {
2614
+ println!(
2615
+ "WARNING: `rust.{}` has no effect with `rust.download-rustc`." ,
2616
+ stringify!( $name) . replace( "_" , "-" )
2617
+ ) ;
2618
+ }
2619
+ } ;
2620
+ }
2621
+
2622
+ let Rust {
2623
+ // Following options are the CI rustc incompatible ones.
2624
+ optimize,
2625
+ debug_logging,
2626
+ debuginfo_level_rustc,
2627
+ llvm_tools,
2628
+ llvm_bitcode_linker,
2629
+ lto,
2630
+ stack_protector,
2631
+ strip,
2632
+ lld_mode,
2633
+ jemalloc,
2634
+ rpath,
2635
+ channel,
2636
+ description,
2637
+ incremental,
2638
+ default_linker,
2639
+
2640
+ // Rest of the options can simply be ignored.
2641
+ debug : _,
2642
+ codegen_units : _,
2643
+ codegen_units_std : _,
2644
+ debug_assertions : _,
2645
+ debug_assertions_std : _,
2646
+ overflow_checks : _,
2647
+ overflow_checks_std : _,
2648
+ debuginfo_level : _,
2649
+ debuginfo_level_std : _,
2650
+ debuginfo_level_tools : _,
2651
+ debuginfo_level_tests : _,
2652
+ split_debuginfo : _,
2653
+ backtrace : _,
2654
+ parallel_compiler : _,
2655
+ musl_root : _,
2656
+ verbose_tests : _,
2657
+ optimize_tests : _,
2658
+ codegen_tests : _,
2659
+ omit_git_hash : _,
2660
+ dist_src : _,
2661
+ save_toolstates : _,
2662
+ codegen_backends : _,
2663
+ lld : _,
2664
+ deny_warnings : _,
2665
+ backtrace_on_ice : _,
2666
+ verify_llvm_ir : _,
2667
+ thin_lto_import_instr_limit : _,
2668
+ remap_debuginfo : _,
2669
+ test_compare_mode : _,
2670
+ llvm_libunwind : _,
2671
+ control_flow_guard : _,
2672
+ ehcont_guard : _,
2673
+ new_symbol_mangling : _,
2674
+ profile_generate : _,
2675
+ profile_use : _,
2676
+ download_rustc : _,
2677
+ validate_mir_opts : _,
2678
+ frame_pointers : _,
2679
+ } = rust;
2680
+
2681
+ // There are two kinds of checks for CI rustc incompatible options:
2682
+ // 1. Checking an option that may change the compiler behaviour/output.
2683
+ // 2. Checking an option that have no effect on the compiler behaviour/output.
2684
+ //
2685
+ // If the option belongs to the first category, we call `err` macro for a hard error;
2686
+ // otherwise, we just print a warning with `warn` macro.
2687
+ err ! ( optimize) ;
2688
+ err ! ( debug_logging) ;
2689
+ err ! ( debuginfo_level_rustc) ;
2690
+ err ! ( default_linker) ;
2691
+ err ! ( rpath) ;
2692
+ err ! ( strip) ;
2693
+ err ! ( stack_protector) ;
2694
+ err ! ( lld_mode) ;
2695
+ err ! ( llvm_tools) ;
2696
+ err ! ( llvm_bitcode_linker) ;
2697
+ err ! ( jemalloc) ;
2698
+ err ! ( lto) ;
2699
+
2700
+ warn ! ( channel) ;
2701
+ warn ! ( description) ;
2702
+ warn ! ( incremental) ;
2703
+ }
2704
+
2594
2705
fn set < T > ( field : & mut T , val : Option < T > ) {
2595
2706
if let Some ( v) = val {
2596
2707
* field = v;
0 commit comments