@@ -2505,6 +2505,7 @@ impl Config {
25052505 // Check the config compatibility
25062506 // FIXME: this doesn't cover `--set` flags yet.
25072507 let res = check_incompatible_options_for_ci_rustc (
2508+ self . build ,
25082509 current_config_toml,
25092510 ci_config_toml,
25102511 ) ;
@@ -3086,17 +3087,18 @@ pub(crate) fn check_incompatible_options_for_ci_llvm(
30863087/// Compares the current Rust options against those in the CI rustc builder and detects any incompatible options.
30873088/// It does this by destructuring the `Rust` instance to make sure every `Rust` field is covered and not missing.
30883089fn check_incompatible_options_for_ci_rustc (
3090+ host : TargetSelection ,
30893091 current_config_toml : TomlConfig ,
30903092 ci_config_toml : TomlConfig ,
30913093) -> Result < ( ) , String > {
30923094 macro_rules! err {
3093- ( $current: expr, $expected: expr) => {
3095+ ( $current: expr, $expected: expr, $config_section : expr ) => {
30943096 if let Some ( current) = & $current {
30953097 if Some ( current) != $expected. as_ref( ) {
30963098 return Err ( format!(
3097- "ERROR: Setting `rust. {}` is incompatible with `rust.download-rustc`. \
3099+ "ERROR: Setting `{}` is incompatible with `rust.download-rustc`. \
30983100 Current value: {:?}, Expected value(s): {}{:?}",
3099- stringify!( $expected) . replace( "_" , "-" ) ,
3101+ format! ( "{}.{}" , $config_section , stringify!( $expected) . replace( "_" , "-" ) ) ,
31003102 $current,
31013103 if $expected. is_some( ) { "None/" } else { "" } ,
31023104 $expected,
@@ -3107,13 +3109,13 @@ fn check_incompatible_options_for_ci_rustc(
31073109 }
31083110
31093111 macro_rules! warn {
3110- ( $current: expr, $expected: expr) => {
3112+ ( $current: expr, $expected: expr, $config_section : expr ) => {
31113113 if let Some ( current) = & $current {
31123114 if Some ( current) != $expected. as_ref( ) {
31133115 println!(
3114- "WARNING: `rust. {}` has no effect with `rust.download-rustc`. \
3116+ "WARNING: `{}` has no effect with `rust.download-rustc`. \
31153117 Current value: {:?}, Expected value(s): {}{:?}",
3116- stringify!( $expected) . replace( "_" , "-" ) ,
3118+ format! ( "{}.{}" , $config_section , stringify!( $expected) . replace( "_" , "-" ) ) ,
31173119 $current,
31183120 if $expected. is_some( ) { "None/" } else { "" } ,
31193121 $expected,
@@ -3123,6 +3125,31 @@ fn check_incompatible_options_for_ci_rustc(
31233125 } ;
31243126 }
31253127
3128+ let current_profiler = current_config_toml. build . as_ref ( ) . and_then ( |b| b. profiler ) ;
3129+ let profiler = ci_config_toml. build . as_ref ( ) . and_then ( |b| b. profiler ) ;
3130+ err ! ( current_profiler, profiler, "build" ) ;
3131+
3132+ let current_optimized_compiler_builtins =
3133+ current_config_toml. build . as_ref ( ) . and_then ( |b| b. optimized_compiler_builtins ) ;
3134+ let optimized_compiler_builtins =
3135+ ci_config_toml. build . as_ref ( ) . and_then ( |b| b. optimized_compiler_builtins ) ;
3136+ err ! ( current_optimized_compiler_builtins, optimized_compiler_builtins, "build" ) ;
3137+
3138+ // We always build the in-tree compiler on cross targets, so we only care
3139+ // about the host target here.
3140+ let host_str = host. to_string ( ) ;
3141+ if let Some ( current_cfg) = current_config_toml. target . as_ref ( ) . and_then ( |c| c. get ( & host_str) ) {
3142+ if current_cfg. profiler . is_some ( ) {
3143+ let ci_target_toml = ci_config_toml. target . as_ref ( ) . and_then ( |c| c. get ( & host_str) ) ;
3144+ let ci_cfg = ci_target_toml. ok_or ( format ! (
3145+ "Target specific config for '{host_str}' is not present for CI-rustc"
3146+ ) ) ?;
3147+
3148+ let profiler = & ci_cfg. profiler ;
3149+ err ! ( current_cfg. profiler, profiler, "build" ) ;
3150+ }
3151+ }
3152+
31263153 let ( Some ( current_rust_config) , Some ( ci_rust_config) ) =
31273154 ( current_config_toml. rust , ci_config_toml. rust )
31283155 else {
@@ -3196,24 +3223,24 @@ fn check_incompatible_options_for_ci_rustc(
31963223 // If the option belongs to the first category, we call `err` macro for a hard error;
31973224 // otherwise, we just print a warning with `warn` macro.
31983225
3199- err ! ( current_rust_config. optimize, optimize) ;
3200- err ! ( current_rust_config. randomize_layout, randomize_layout) ;
3201- err ! ( current_rust_config. debug_logging, debug_logging) ;
3202- err ! ( current_rust_config. debuginfo_level_rustc, debuginfo_level_rustc) ;
3203- err ! ( current_rust_config. rpath, rpath) ;
3204- err ! ( current_rust_config. strip, strip) ;
3205- err ! ( current_rust_config. lld_mode, lld_mode) ;
3206- err ! ( current_rust_config. llvm_tools, llvm_tools) ;
3207- err ! ( current_rust_config. llvm_bitcode_linker, llvm_bitcode_linker) ;
3208- err ! ( current_rust_config. jemalloc, jemalloc) ;
3209- err ! ( current_rust_config. default_linker, default_linker) ;
3210- err ! ( current_rust_config. stack_protector, stack_protector) ;
3211- err ! ( current_rust_config. lto, lto) ;
3212- err ! ( current_rust_config. std_features, std_features) ;
3213-
3214- warn ! ( current_rust_config. channel, channel) ;
3215- warn ! ( current_rust_config. description, description) ;
3216- warn ! ( current_rust_config. incremental, incremental) ;
3226+ err ! ( current_rust_config. optimize, optimize, "rust" ) ;
3227+ err ! ( current_rust_config. randomize_layout, randomize_layout, "rust" ) ;
3228+ err ! ( current_rust_config. debug_logging, debug_logging, "rust" ) ;
3229+ err ! ( current_rust_config. debuginfo_level_rustc, debuginfo_level_rustc, "rust" ) ;
3230+ err ! ( current_rust_config. rpath, rpath, "rust" ) ;
3231+ err ! ( current_rust_config. strip, strip, "rust" ) ;
3232+ err ! ( current_rust_config. lld_mode, lld_mode, "rust" ) ;
3233+ err ! ( current_rust_config. llvm_tools, llvm_tools, "rust" ) ;
3234+ err ! ( current_rust_config. llvm_bitcode_linker, llvm_bitcode_linker, "rust" ) ;
3235+ err ! ( current_rust_config. jemalloc, jemalloc, "rust" ) ;
3236+ err ! ( current_rust_config. default_linker, default_linker, "rust" ) ;
3237+ err ! ( current_rust_config. stack_protector, stack_protector, "rust" ) ;
3238+ err ! ( current_rust_config. lto, lto, "rust" ) ;
3239+ err ! ( current_rust_config. std_features, std_features, "rust" ) ;
3240+
3241+ warn ! ( current_rust_config. channel, channel, "rust" ) ;
3242+ warn ! ( current_rust_config. description, description, "rust" ) ;
3243+ warn ! ( current_rust_config. incremental, incremental, "rust" ) ;
32173244
32183245 Ok ( ( ) )
32193246}
0 commit comments