@@ -38,6 +38,24 @@ macro_rules! check_ci_llvm {
38
38
} ;
39
39
}
40
40
41
+ macro_rules! err_incompatible_ci_rustc_option {
42
+ ( $name: expr, $option_name: literal) => {
43
+ assert!(
44
+ $name. is_none( ) ,
45
+ "ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`." ,
46
+ $option_name
47
+ ) ;
48
+ } ;
49
+ }
50
+
51
+ macro_rules! warn_incompatible_ci_rustc_option {
52
+ ( $name: expr, $option_name: literal) => {
53
+ if $name. is_some( ) {
54
+ println!( "WARNING: `rust.{}` has no effect with `rust.download-rustc`." , $option_name) ;
55
+ }
56
+ } ;
57
+ }
58
+
41
59
#[ derive( Clone , Default ) ]
42
60
pub enum DryRun {
43
61
/// This isn't a dry run.
@@ -1605,11 +1623,56 @@ impl Config {
1605
1623
} = rust;
1606
1624
1607
1625
is_user_configured_rust_channel = channel. is_some ( ) ;
1608
- set ( & mut config. channel , channel) ;
1626
+ set ( & mut config. channel , channel. clone ( ) ) ;
1609
1627
1610
1628
config. download_rustc_commit = config. download_ci_rustc_commit ( download_rustc) ;
1611
1629
1612
- // FIXME: handle download-rustc incompatible options.
1630
+ // There are two kinds of checks for CI rustc incompatible options:
1631
+ // 1. Checking an option that may change the compiler behaviour/output.
1632
+ // 2. Checking an option that have no effect on the compiler behaviour/output.
1633
+ //
1634
+ // If the option belongs to the first category, we call `err_incompatible_ci_rustc_option` macro
1635
+ // for a hard error; otherwise, we just print a warning with `warn_incompatible_ci_rustc_option` macro.
1636
+ if config. download_rustc_commit . is_some ( ) {
1637
+ err_incompatible_ci_rustc_option ! ( optimize_toml, "optimize" ) ;
1638
+ err_incompatible_ci_rustc_option ! ( debug_toml, "debug" ) ;
1639
+ err_incompatible_ci_rustc_option ! ( codegen_units, "codegen-units" ) ;
1640
+ err_incompatible_ci_rustc_option ! ( codegen_units_std, "codegen-units-std" ) ;
1641
+ err_incompatible_ci_rustc_option ! ( debug_assertions_toml, "debug-assertions" ) ;
1642
+ err_incompatible_ci_rustc_option ! (
1643
+ debug_assertions_std_toml,
1644
+ "debug-assertions-std"
1645
+ ) ;
1646
+ err_incompatible_ci_rustc_option ! ( debug_logging, "debug-logging" ) ;
1647
+ err_incompatible_ci_rustc_option ! ( overflow_checks_toml, "overflow-checks" ) ;
1648
+ err_incompatible_ci_rustc_option ! ( overflow_checks_std_toml, "overflow-checks-std" ) ;
1649
+ err_incompatible_ci_rustc_option ! ( debuginfo_level_toml, "debuginfo-level" ) ;
1650
+ err_incompatible_ci_rustc_option ! (
1651
+ debuginfo_level_rustc_toml,
1652
+ "debuginfo-level-rustc"
1653
+ ) ;
1654
+ err_incompatible_ci_rustc_option ! ( debuginfo_level_std_toml, "debuginfo-level-std" ) ;
1655
+ err_incompatible_ci_rustc_option ! ( split_debuginfo, "split-debuginfo" ) ;
1656
+ err_incompatible_ci_rustc_option ! ( backtrace, "backtrace" ) ;
1657
+ err_incompatible_ci_rustc_option ! ( default_linker, "default-linker" ) ;
1658
+ err_incompatible_ci_rustc_option ! ( rpath, "rpath" ) ;
1659
+ err_incompatible_ci_rustc_option ! ( strip, "strip" ) ;
1660
+ err_incompatible_ci_rustc_option ! ( frame_pointers, "frame-pointers" ) ;
1661
+ err_incompatible_ci_rustc_option ! ( stack_protector, "stack-protector" ) ;
1662
+ err_incompatible_ci_rustc_option ! ( lld_mode, "use-lld" ) ;
1663
+ err_incompatible_ci_rustc_option ! ( llvm_tools, "llvm-tools" ) ;
1664
+ err_incompatible_ci_rustc_option ! ( llvm_bitcode_linker, "llvm-bitcode-linker" ) ;
1665
+ err_incompatible_ci_rustc_option ! ( jemalloc, "jemalloc" ) ;
1666
+ err_incompatible_ci_rustc_option ! ( control_flow_guard, "control-flow-guard" ) ;
1667
+ err_incompatible_ci_rustc_option ! ( ehcont_guard, "ehcont-guard" ) ;
1668
+ err_incompatible_ci_rustc_option ! ( lto, "lto" ) ;
1669
+ err_incompatible_ci_rustc_option ! ( validate_mir_opts, "validate-mir-opts" ) ;
1670
+ err_incompatible_ci_rustc_option ! ( parallel_compiler, "parallel-compiler" ) ;
1671
+
1672
+ warn_incompatible_ci_rustc_option ! ( channel, "channel" ) ;
1673
+ warn_incompatible_ci_rustc_option ! ( description, "description" ) ;
1674
+ warn_incompatible_ci_rustc_option ! ( incremental, "incremental" ) ;
1675
+ }
1613
1676
1614
1677
debug = debug_toml;
1615
1678
debug_assertions = debug_assertions_toml;
0 commit comments