From ab8101d0196b6d1d0161b47fadff22bc82195fe5 Mon Sep 17 00:00:00 2001 From: SparrowLii Date: Tue, 31 Oct 2023 16:36:40 +0800 Subject: [PATCH 1/3] enable parallel rustc in nightly builds --- src/bootstrap/src/core/config/config.rs | 7 +++++-- src/ci/run.sh | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index f56e46010f371..95d34aaf285d5 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1072,6 +1072,7 @@ impl Config { config.bindir = "bin".into(); config.dist_include_mingw_linker = true; config.dist_compression_profile = "fast".into(); + config.rustc_parallel = true; config.stdout_is_tty = std::io::stdout().is_terminal(); config.stderr_is_tty = std::io::stderr().is_terminal(); @@ -1111,7 +1112,7 @@ impl Config { fn parse_inner(args: &[String], get_toml: impl Fn(&Path) -> TomlConfig) -> Config { let mut flags = Flags::parse(&args); - let mut config = Config::default_opts(); + let mut config: Config = Config::default_opts(); // Set flags. config.paths = std::mem::take(&mut flags.paths); @@ -1429,7 +1430,9 @@ impl Config { set(&mut config.use_lld, rust.use_lld); set(&mut config.lld_enabled, rust.lld); set(&mut config.llvm_tools_enabled, rust.llvm_tools); - config.rustc_parallel = rust.parallel_compiler.unwrap_or(false); + config.rustc_parallel = rust + .parallel_compiler + .unwrap_or(config.channel == "dev" || config.channel == "nightly"); config.rustc_default_linker = rust.default_linker; config.musl_root = rust.musl_root.map(PathBuf::from); config.save_toolstates = rust.save_toolstates.map(PathBuf::from); diff --git a/src/ci/run.sh b/src/ci/run.sh index 9a63bb5c91c9b..f67bfb7920ee3 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -98,8 +98,8 @@ if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions" elif [ "$DEPLOY_ALT" != "" ]; then - if [ "$NO_PARALLEL_COMPILER" = "" ]; then - RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.parallel-compiler" + if [ "$ALT_PARALLEL_COMPILER" = "" ]; then + RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.parallel-compiler=false" fi RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-assertions" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.verify-llvm-ir" From bf5fb7614b2d7fe6a3c2a9a2c922734c03e8dab6 Mon Sep 17 00:00:00 2001 From: SparrowLii Date: Tue, 31 Oct 2023 16:52:16 +0800 Subject: [PATCH 2/3] update bootstrap change history --- config.example.toml | 2 +- src/bootstrap/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.example.toml b/config.example.toml index 66fa91d4bad15..698e3d62ae41d 100644 --- a/config.example.toml +++ b/config.example.toml @@ -30,7 +30,7 @@ # # If `change-id` does not match the version that is currently running, # `x.py` will prompt you to update it and check the related PR for more details. -change-id = 116998 +change-id = 117435 # ============================================================================= # Tweaking how LLVM is compiled diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index d7f49a6d11b9c..80d6b77e96ba0 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -77,7 +77,7 @@ const LLD_FILE_NAMES: &[&str] = &["ld.lld", "ld64.lld", "lld-link", "wasm-ld"]; /// /// If you make any major changes (such as adding new values or changing default values), please /// ensure that the associated PR ID is added to the end of this list. -pub const CONFIG_CHANGE_HISTORY: &[usize] = &[115898, 116998]; +pub const CONFIG_CHANGE_HISTORY: &[usize] = &[115898, 116998, 117435]; /// Extra --check-cfg to add when building /// (Mode restriction, config name, config values (if any)) From 248dd14fa590b55b237098ff377e702e4d336bd1 Mon Sep 17 00:00:00 2001 From: SparrowLii Date: Tue, 31 Oct 2023 17:30:41 +0800 Subject: [PATCH 3/3] update config.example.toml --- config.example.toml | 9 +++++---- src/bootstrap/src/core/config/config.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config.example.toml b/config.example.toml index 698e3d62ae41d..4984cf8ba1e7c 100644 --- a/config.example.toml +++ b/config.example.toml @@ -553,10 +553,11 @@ change-id = 117435 # Whether to always use incremental compilation when building rustc #incremental = false -# Build a multi-threaded rustc -# FIXME(#75760): Some UI tests fail when this option is enabled. -# NOTE: This option is NOT SUPPORTED. See #48685. -#parallel-compiler = false +# Build a multi-threaded rustc. This allows users to use parallel rustc +# via the unstable option `-Z threads=n`. +# Since stable/beta channels only allow using stable features, +# `parallel-compiler = false` should be set for these channels. +#parallel-compiler = true # The default linker that will be hard-coded into the generated # compiler for targets that don't specify a default linker explicitly diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 95d34aaf285d5..a871399453e4f 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1112,7 +1112,7 @@ impl Config { fn parse_inner(args: &[String], get_toml: impl Fn(&Path) -> TomlConfig) -> Config { let mut flags = Flags::parse(&args); - let mut config: Config = Config::default_opts(); + let mut config = Config::default_opts(); // Set flags. config.paths = std::mem::take(&mut flags.paths);