Skip to content

Commit 120d93e

Browse files
committed
move rust config to the top of parse method
1 parent 39d9cf7 commit 120d93e

File tree

1 file changed

+58
-59
lines changed

1 file changed

+58
-59
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,62 @@ impl Config {
556556
datadir: install_datadir_toml,
557557
} = toml.install.unwrap_or_default();
558558

559+
let Rust {
560+
optimize: rust_optimize_toml,
561+
debug: rust_debug_toml,
562+
codegen_units: rust_codegen_units_toml,
563+
codegen_units_std: rust_codegen_units_std_toml,
564+
rustc_debug_assertions: rust_rustc_debug_assertions_toml,
565+
std_debug_assertions: rust_std_debug_assertions_toml,
566+
tools_debug_assertions: rust_tools_debug_assertions_toml,
567+
overflow_checks: rust_overflow_checks_toml,
568+
overflow_checks_std: rust_overflow_checks_std_toml,
569+
debug_logging: rust_debug_logging_toml,
570+
debuginfo_level: rust_debuginfo_level_toml,
571+
debuginfo_level_rustc: rust_debuginfo_level_rustc_toml,
572+
debuginfo_level_std: rust_debuginfo_level_std_toml,
573+
debuginfo_level_tools: rust_debuginfo_level_tools_toml,
574+
debuginfo_level_tests: rust_debuginfo_level_tests_toml,
575+
backtrace: rust_backtrace_toml,
576+
incremental: rust_incremental_toml,
577+
randomize_layout: rust_randomize_layout_toml,
578+
default_linker: rust_default_linker_toml,
579+
channel: rust_channel_toml,
580+
musl_root: rust_musl_root_toml,
581+
rpath: rust_rpath_toml,
582+
verbose_tests: rust_verbose_tests_toml,
583+
optimize_tests: rust_optimize_tests_toml,
584+
codegen_tests: rust_codegen_tests_toml,
585+
omit_git_hash: rust_omit_git_hash_toml,
586+
dist_src: rust_dist_src_toml,
587+
save_toolstates: rust_save_toolstates_toml,
588+
codegen_backends: rust_codegen_backends_toml,
589+
lld: rust_lld_enabled_toml,
590+
llvm_tools: rust_llvm_tools_toml,
591+
llvm_bitcode_linker: rust_llvm_bitcode_linker_toml,
592+
deny_warnings: rust_deny_warnings_toml,
593+
backtrace_on_ice: rust_backtrace_on_ice_toml,
594+
verify_llvm_ir: rust_verify_llvm_ir_toml,
595+
thin_lto_import_instr_limit: rust_thin_lto_import_instr_limit_toml,
596+
remap_debuginfo: rust_remap_debuginfo_toml,
597+
jemalloc: rust_jemalloc_toml,
598+
test_compare_mode: rust_test_compare_mode_toml,
599+
llvm_libunwind: rust_llvm_libunwind_toml,
600+
control_flow_guard: rust_control_flow_guard_toml,
601+
ehcont_guard: rust_ehcont_guard_toml,
602+
new_symbol_mangling: rust_new_symbol_mangling_toml,
603+
profile_generate: rust_profile_generate_toml,
604+
profile_use: rust_profile_use_toml,
605+
download_rustc: rust_download_rustc_toml,
606+
lto: rust_lto_toml,
607+
validate_mir_opts: rust_validate_mir_opts_toml,
608+
frame_pointers: rust_frame_pointers_toml,
609+
stack_protector: rust_stack_protector_toml,
610+
strip: rust_strip_toml,
611+
lld_mode: rust_lld_mode_toml,
612+
std_features: rust_std_features_toml,
613+
} = toml.rust.unwrap_or_default();
614+
559615
if cfg!(test) {
560616
// When configuring bootstrap for tests, make sure to set the rustc and Cargo to the
561617
// same ones used to call the tests (if custom ones are not defined in the toml). If we
@@ -786,8 +842,7 @@ impl Config {
786842
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
787843
let ci_channel = file_content.trim_end();
788844

789-
let toml_channel = toml.rust.as_ref().and_then(|r| r.channel.clone());
790-
let is_user_configured_rust_channel = match toml_channel {
845+
let is_user_configured_rust_channel = match rust_channel_toml {
791846
Some(channel) if channel == "auto-detect" => {
792847
config.channel = ci_channel.into();
793848
true
@@ -800,7 +855,7 @@ impl Config {
800855
};
801856

802857
let default = config.channel == "dev";
803-
config.omit_git_hash = toml.rust.as_ref().and_then(|r| r.omit_git_hash).unwrap_or(default);
858+
config.omit_git_hash = rust_omit_git_hash_toml.unwrap_or(default);
804859

805860
config.rust_info = config.git_info(config.omit_git_hash, &config.src);
806861
config.cargo_info =
@@ -894,62 +949,6 @@ impl Config {
894949
}
895950
}
896951

897-
let Rust {
898-
optimize: rust_optimize_toml,
899-
debug: rust_debug_toml,
900-
codegen_units: rust_codegen_units_toml,
901-
codegen_units_std: rust_codegen_units_std_toml,
902-
rustc_debug_assertions: rust_rustc_debug_assertions_toml,
903-
std_debug_assertions: rust_std_debug_assertions_toml,
904-
tools_debug_assertions: rust_tools_debug_assertions_toml,
905-
overflow_checks: rust_overflow_checks_toml,
906-
overflow_checks_std: rust_overflow_checks_std_toml,
907-
debug_logging: rust_debug_logging_toml,
908-
debuginfo_level: rust_debuginfo_level_toml,
909-
debuginfo_level_rustc: rust_debuginfo_level_rustc_toml,
910-
debuginfo_level_std: rust_debuginfo_level_std_toml,
911-
debuginfo_level_tools: rust_debuginfo_level_tools_toml,
912-
debuginfo_level_tests: rust_debuginfo_level_tests_toml,
913-
backtrace: rust_backtrace_toml,
914-
incremental: rust_incremental_toml,
915-
randomize_layout: rust_randomize_layout_toml,
916-
default_linker: rust_default_linker_toml,
917-
channel: _, // already handled above
918-
musl_root: rust_musl_root_toml,
919-
rpath: rust_rpath_toml,
920-
verbose_tests: rust_verbose_tests_toml,
921-
optimize_tests: rust_optimize_tests_toml,
922-
codegen_tests: rust_codegen_tests_toml,
923-
omit_git_hash: _, // already handled above
924-
dist_src: rust_dist_src_toml,
925-
save_toolstates: rust_save_toolstates_toml,
926-
codegen_backends: rust_codegen_backends_toml,
927-
lld: rust_lld_enabled_toml,
928-
llvm_tools: rust_llvm_tools_toml,
929-
llvm_bitcode_linker: rust_llvm_bitcode_linker_toml,
930-
deny_warnings: rust_deny_warnings_toml,
931-
backtrace_on_ice: rust_backtrace_on_ice_toml,
932-
verify_llvm_ir: rust_verify_llvm_ir_toml,
933-
thin_lto_import_instr_limit: rust_thin_lto_import_instr_limit_toml,
934-
remap_debuginfo: rust_remap_debuginfo_toml,
935-
jemalloc: rust_jemalloc_toml,
936-
test_compare_mode: rust_test_compare_mode_toml,
937-
llvm_libunwind: rust_llvm_libunwind_toml,
938-
control_flow_guard: rust_control_flow_guard_toml,
939-
ehcont_guard: rust_ehcont_guard_toml,
940-
new_symbol_mangling: rust_new_symbol_mangling_toml,
941-
profile_generate: rust_profile_generate_toml,
942-
profile_use: rust_profile_use_toml,
943-
download_rustc: rust_download_rustc_toml,
944-
lto: rust_lto_toml,
945-
validate_mir_opts: rust_validate_mir_opts_toml,
946-
frame_pointers: rust_frame_pointers_toml,
947-
stack_protector: rust_stack_protector_toml,
948-
strip: rust_strip_toml,
949-
lld_mode: rust_lld_mode_toml,
950-
std_features: rust_std_features_toml,
951-
} = toml.rust.unwrap_or_default();
952-
953952
// FIXME(#133381): alt rustc builds currently do *not* have rustc debug assertions
954953
// enabled. We should not download a CI alt rustc if we need rustc to have debug
955954
// assertions (e.g. for crashes test suite). This can be changed once something like

0 commit comments

Comments
 (0)