@@ -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,37 @@ 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_logging, "debug-logging" ) ;
1639
+ err_incompatible_ci_rustc_option ! (
1640
+ debuginfo_level_rustc_toml,
1641
+ "debuginfo-level-rustc"
1642
+ ) ;
1643
+ err_incompatible_ci_rustc_option ! ( default_linker, "default-linker" ) ;
1644
+ err_incompatible_ci_rustc_option ! ( rpath, "rpath" ) ;
1645
+ err_incompatible_ci_rustc_option ! ( strip, "strip" ) ;
1646
+ err_incompatible_ci_rustc_option ! ( stack_protector, "stack-protector" ) ;
1647
+ err_incompatible_ci_rustc_option ! ( lld_mode, "use-lld" ) ;
1648
+ err_incompatible_ci_rustc_option ! ( llvm_tools, "llvm-tools" ) ;
1649
+ err_incompatible_ci_rustc_option ! ( llvm_bitcode_linker, "llvm-bitcode-linker" ) ;
1650
+ err_incompatible_ci_rustc_option ! ( jemalloc, "jemalloc" ) ;
1651
+ err_incompatible_ci_rustc_option ! ( lto, "lto" ) ;
1652
+
1653
+ warn_incompatible_ci_rustc_option ! ( channel, "channel" ) ;
1654
+ warn_incompatible_ci_rustc_option ! ( description, "description" ) ;
1655
+ warn_incompatible_ci_rustc_option ! ( incremental, "incremental" ) ;
1656
+ }
1613
1657
1614
1658
debug = debug_toml;
1615
1659
debug_assertions = debug_assertions_toml;
0 commit comments