From 3c11e970470cd5a5e1436b2424785e257d9754e4 Mon Sep 17 00:00:00 2001 From: Matthew Healy Date: Thu, 19 Dec 2019 19:46:19 +0100 Subject: [PATCH 1/6] Document LLVM skip-rebuild config.toml option --- config.toml.example | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.toml.example b/config.toml.example index 5152a6c988582..f12ff76284589 100644 --- a/config.toml.example +++ b/config.toml.example @@ -14,6 +14,12 @@ # ============================================================================= [llvm] +# Indicates whether LLVM rebuild should be skipped when running bootstrap. If +# this is `false` then the compiler's LLVM will be rebuilt whenever the built +# version doesn't have the correct hash. If it is `true` then LLVM will never +# be rebuilt. The default value is `false`. +#skip-rebuild = false + # Indicates whether the LLVM build is a Release or Debug build #optimize = true From b05d9ee3bab305b710badc0125dd6d3c579d051b Mon Sep 17 00:00:00 2001 From: Matthew Healy Date: Thu, 19 Dec 2019 19:55:42 +0100 Subject: [PATCH 2/6] Parse llvm_skip_rebuild into Config --- src/bootstrap/config.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 5f2ef01bd5c45..130eea56ad300 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -66,6 +66,7 @@ pub struct Config { pub backtrace_on_ice: bool, // llvm codegen options + pub llvm_skip_rebuild: bool, pub llvm_assertions: bool, pub llvm_optimize: bool, pub llvm_thin_lto: bool, @@ -242,6 +243,7 @@ struct Install { #[derive(Deserialize, Default)] #[serde(deny_unknown_fields, rename_all = "kebab-case")] struct Llvm { + skip_rebuild: Option, optimize: Option, thin_lto: Option, release_debuginfo: Option, @@ -487,6 +489,7 @@ impl Config { // Store off these values as options because if they're not provided // we'll infer default values for them later + let mut llvm_skip_rebuild = None; let mut llvm_assertions = None; let mut debug = None; let mut debug_assertions = None; @@ -510,6 +513,7 @@ impl Config { } set(&mut config.ninja, llvm.ninja); llvm_assertions = llvm.assertions; + llvm_skip_rebuild = llvm.skip_rebuild; set(&mut config.llvm_optimize, llvm.optimize); set(&mut config.llvm_thin_lto, llvm.thin_lto); set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo); @@ -617,6 +621,8 @@ impl Config { set(&mut config.initial_rustc, build.rustc.map(PathBuf::from)); set(&mut config.initial_cargo, build.cargo.map(PathBuf::from)); + config.llvm_skip_rebuild = llvm_skip_rebuild.unwrap_or(false); + let default = false; config.llvm_assertions = llvm_assertions.unwrap_or(default); From 522f97754d5416c6e1e61b601cd78470d79b168c Mon Sep 17 00:00:00 2001 From: Matthew Healy Date: Thu, 19 Dec 2019 20:42:01 +0100 Subject: [PATCH 3/6] Skip LLVM rebuild when skip-rebuild is true --- src/bootstrap/native.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index be13b9aa2eb49..341d9b9446a12 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -74,6 +74,13 @@ impl Step for Llvm { let done_stamp = out_dir.join("llvm-finished-building"); if done_stamp.exists() { + if builder.config.llvm_skip_rebuild { + builder.info("Warning: \ + Using a potentially stale build of LLVM; \ + This may not behave well."); + return build_llvm_config; + } + if let Some(llvm_commit) = llvm_info.sha() { let done_contents = t!(fs::read(&done_stamp)); From 3c56a65bc42fa83edbcdfdb5357e99c5557755cb Mon Sep 17 00:00:00 2001 From: king6cong Date: Tue, 24 Dec 2019 11:59:57 +0800 Subject: [PATCH 4/6] reuse `capacity` variable in slice::repeat --- src/liballoc/slice.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 2f6d10c027be3..7b83658fca60d 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -450,7 +450,8 @@ impl [T] { // and `rem` is the remaining part of `n`. // Using `Vec` to access `set_len()`. - let mut buf = Vec::with_capacity(self.len().checked_mul(n).expect("capacity overflow")); + let capacity = self.len().checked_mul(n).expect("capacity overflow"); + let mut buf = Vec::with_capacity(capacity); // `2^expn` repetition is done by doubling `buf` `expn`-times. buf.extend(self); @@ -476,7 +477,7 @@ impl [T] { // `rem` (`= n - 2^expn`) repetition is done by copying // first `rem` repetitions from `buf` itself. - let rem_len = self.len() * n - buf.len(); // `self.len() * rem` + let rem_len = capacity - buf.len(); // `self.len() * rem` if rem_len > 0 { // `buf.extend(buf[0 .. rem_len])`: unsafe { @@ -487,8 +488,7 @@ impl [T] { rem_len, ); // `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`). - let buf_cap = buf.capacity(); - buf.set_len(buf_cap); + buf.set_len(capacity); } } buf From 0af399a282a5493a3e7324cc9e0fdb7224fb3888 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 24 Dec 2019 11:51:40 +0100 Subject: [PATCH 5/6] update miri --- src/tools/miri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri b/src/tools/miri index 048af409232fc..b1e97df8ee3d6 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit 048af409232fc2d7f8fbe5469080dc8bb702c498 +Subproject commit b1e97df8ee3d67b74b3408579f29b017c4c317ea From 04c740bee3f453cb06fbfa6581a2ee53023d39b9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 24 Dec 2019 11:54:25 +0100 Subject: [PATCH 6/6] bootstrap miri: remove no longer used env var --- src/bootstrap/test.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 58dc8ffc17da2..f2a7d1d00cf28 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -384,9 +384,6 @@ impl Step for Miri { ); cargo.arg("--bin").arg("cargo-miri").arg("--").arg("miri").arg("setup"); - // Tell `cargo miri` not to worry about the sysroot mismatch (we built with - // stage1 but run with stage2). - cargo.env("MIRI_SKIP_SYSROOT_CHECK", "1"); // Tell `cargo miri setup` where to find the sources. cargo.env("XARGO_RUST_SRC", builder.src.join("src")); // Debug things.