@@ -2505,6 +2505,7 @@ impl Config {
2505
2505
// Check the config compatibility
2506
2506
// FIXME: this doesn't cover `--set` flags yet.
2507
2507
let res = check_incompatible_options_for_ci_rustc (
2508
+ self . build ,
2508
2509
current_config_toml,
2509
2510
ci_config_toml,
2510
2511
) ;
@@ -3086,17 +3087,18 @@ pub(crate) fn check_incompatible_options_for_ci_llvm(
3086
3087
/// Compares the current Rust options against those in the CI rustc builder and detects any incompatible options.
3087
3088
/// It does this by destructuring the `Rust` instance to make sure every `Rust` field is covered and not missing.
3088
3089
fn check_incompatible_options_for_ci_rustc (
3090
+ host : TargetSelection ,
3089
3091
current_config_toml : TomlConfig ,
3090
3092
ci_config_toml : TomlConfig ,
3091
3093
) -> Result < ( ) , String > {
3092
3094
macro_rules! err {
3093
- ( $current: expr, $expected: expr) => {
3095
+ ( $current: expr, $expected: expr, $config_section : expr ) => {
3094
3096
if let Some ( current) = & $current {
3095
3097
if Some ( current) != $expected. as_ref( ) {
3096
3098
return Err ( format!(
3097
- "ERROR: Setting `rust. {}` is incompatible with `rust.download-rustc`. \
3099
+ "ERROR: Setting `{}` is incompatible with `rust.download-rustc`. \
3098
3100
Current value: {:?}, Expected value(s): {}{:?}",
3099
- stringify!( $expected) . replace( "_" , "-" ) ,
3101
+ format! ( "{}.{}" , $config_section , stringify!( $expected) . replace( "_" , "-" ) ) ,
3100
3102
$current,
3101
3103
if $expected. is_some( ) { "None/" } else { "" } ,
3102
3104
$expected,
@@ -3107,13 +3109,13 @@ fn check_incompatible_options_for_ci_rustc(
3107
3109
}
3108
3110
3109
3111
macro_rules! warn {
3110
- ( $current: expr, $expected: expr) => {
3112
+ ( $current: expr, $expected: expr, $config_section : expr ) => {
3111
3113
if let Some ( current) = & $current {
3112
3114
if Some ( current) != $expected. as_ref( ) {
3113
3115
println!(
3114
- "WARNING: `rust. {}` has no effect with `rust.download-rustc`. \
3116
+ "WARNING: `{}` has no effect with `rust.download-rustc`. \
3115
3117
Current value: {:?}, Expected value(s): {}{:?}",
3116
- stringify!( $expected) . replace( "_" , "-" ) ,
3118
+ format! ( "{}.{}" , $config_section , stringify!( $expected) . replace( "_" , "-" ) ) ,
3117
3119
$current,
3118
3120
if $expected. is_some( ) { "None/" } else { "" } ,
3119
3121
$expected,
@@ -3123,6 +3125,31 @@ fn check_incompatible_options_for_ci_rustc(
3123
3125
} ;
3124
3126
}
3125
3127
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
+
3126
3153
let ( Some ( current_rust_config) , Some ( ci_rust_config) ) =
3127
3154
( current_config_toml. rust , ci_config_toml. rust )
3128
3155
else {
@@ -3196,24 +3223,24 @@ fn check_incompatible_options_for_ci_rustc(
3196
3223
// If the option belongs to the first category, we call `err` macro for a hard error;
3197
3224
// otherwise, we just print a warning with `warn` macro.
3198
3225
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" ) ;
3217
3244
3218
3245
Ok ( ( ) )
3219
3246
}
0 commit comments