diff options
| author | bors <bors@rust-lang.org> | 2021-06-10 03:11:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-06-10 03:11:24 +0000 |
| commit | c5fbcd35a8217a17f6b63a22217ace06cf8f5f02 (patch) | |
| tree | 32d947c1d7b0e634a699956cdae8c2fd664ba58f /src | |
| parent | 1639a16ebfaad2aa74fd535c778fd1614475b53d (diff) | |
| parent | a6b7e1c121152a222e732fb71c2eeb1bfb9c1d3d (diff) | |
| download | rust-c5fbcd35a8217a17f6b63a22217ace06cf8f5f02.tar.gz rust-c5fbcd35a8217a17f6b63a22217ace06cf8f5f02.zip | |
Auto merge of #86186 - JohnTitor:rollup-upaw6wx, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #82037 (Make symbols stripping work on MacOS X) - #84687 (Multiple improvements to RwLocks) - #85997 (rustdoc: Print a warning if the diff when comparing to old nightlies is empty) - #86051 (Updated code examples and wording in move keyword documentation ) - #86111 (fix off by one in `std::iter::Iterator` documentation) - #86113 (build doctests with lld if use-lld = true) - #86175 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/bin/rustdoc.rs | 7 | ||||
| -rw-r--r-- | src/bootstrap/builder.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 15 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 17 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 30 | ||||
| m--------- | src/tools/miri | 24 |
6 files changed, 63 insertions, 34 deletions
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index cba17c8e608..e4396d53016 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -41,7 +41,12 @@ fn main() { cmd.arg(arg); } if env::var_os("RUSTDOC_FUSE_LD_LLD").is_some() { - cmd.arg("-Clink-args=-fuse-ld=lld"); + cmd.arg("-Clink-arg=-fuse-ld=lld"); + if cfg!(windows) { + cmd.arg("-Clink-arg=-Wl,/threads:1"); + } else { + cmd.arg("-Clink-arg=-Wl,--threads=1"); + } } // Needed to be able to run all rustdoc tests. diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 06f8bf89dae..bc499fdba59 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1142,6 +1142,7 @@ impl<'a> Builder<'a> { } if self.is_fuse_ld_lld(compiler.host) { cargo.env("RUSTC_HOST_FUSE_LD_LLD", "1"); + cargo.env("RUSTDOC_FUSE_LD_LLD", "1"); } if let Some(target_linker) = self.linker(target) { @@ -1151,6 +1152,9 @@ impl<'a> Builder<'a> { if self.is_fuse_ld_lld(target) { rustflags.arg("-Clink-args=-fuse-ld=lld"); } + self.lld_flags(target).for_each(|flag| { + rustdocflags.arg(&flag); + }); if !(["build", "check", "clippy", "fix", "rustc"].contains(&cmd)) && want_rustdoc { cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler)); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 21c7dd11d24..347236c655a 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -923,6 +923,21 @@ impl Build { self.config.use_lld && !target.contains("msvc") } + fn lld_flags(&self, target: TargetSelection) -> impl Iterator<Item = String> { + let mut options = [None, None]; + + if self.config.use_lld { + if self.is_fuse_ld_lld(target) { + options[0] = Some("-Clink-arg=-fuse-ld=lld".to_string()); + } + + let threads = if target.contains("windows") { "/threads:1" } else { "--threads=1" }; + options[1] = Some(format!("-Clink-arg=-Wl,{}", threads)); + } + + std::array::IntoIter::new(options).flatten() + } + /// Returns if this target should statically link the C runtime, if specified fn crt_static(&self, target: TargetSelection) -> Option<bool> { if target.contains("pc-windows-msvc") { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index cc7c143d474..70cf1b105c0 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1131,19 +1131,6 @@ struct Compiletest { compare_mode: Option<&'static str>, } -impl Compiletest { - fn add_lld_flags(builder: &Builder<'_>, target: TargetSelection, flags: &mut Vec<String>) { - if builder.config.use_lld { - if builder.is_fuse_ld_lld(target) { - flags.push("-Clink-arg=-fuse-ld=lld".to_string()); - } - - let threads = if target.contains("windows") { "/threads:1" } else { "--threads=1" }; - flags.push(format!("-Clink-arg=-Wl,{}", threads)); - } - } -} - impl Step for Compiletest { type Output = (); @@ -1289,12 +1276,12 @@ note: if you're sure you want to do this, please open an issue as to why. In the let mut hostflags = flags.clone(); hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display())); - Self::add_lld_flags(builder, compiler.host, &mut hostflags); + hostflags.extend(builder.lld_flags(compiler.host)); cmd.arg("--host-rustcflags").arg(hostflags.join(" ")); let mut targetflags = flags; targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); - Self::add_lld_flags(builder, target, &mut targetflags); + targetflags.extend(builder.lld_flags(target)); cmd.arg("--target-rustcflags").arg(targetflags.join(" ")); cmd.arg("--docck-python").arg(builder.python()); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 931c822ffe2..1e7c3930246 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2488,6 +2488,7 @@ impl<'test> TestCx<'test> { { let mut diff_output = File::create(&diff_filename).unwrap(); + let mut wrote_data = false; for entry in walkdir::WalkDir::new(out_dir) { let entry = entry.expect("failed to read file"); let extension = entry.path().extension().and_then(|p| p.to_str()); @@ -2500,17 +2501,28 @@ impl<'test> TestCx<'test> { if let Ok(s) = std::fs::read(&expected_path) { s } else { continue }; let actual_path = entry.path(); let actual = std::fs::read(&actual_path).unwrap(); - diff_output - .write_all(&unified_diff::diff( - &expected, - &expected_path.to_string_lossy(), - &actual, - &actual_path.to_string_lossy(), - 3, - )) - .unwrap(); + let diff = unified_diff::diff( + &expected, + &expected_path.to_string_lossy(), + &actual, + &actual_path.to_string_lossy(), + 3, + ); + wrote_data |= !diff.is_empty(); + diff_output.write_all(&diff).unwrap(); } } + + if !wrote_data { + println!("note: diff is identical to nightly rustdoc"); + assert!(diff_output.metadata().unwrap().len() == 0); + return; + } else if self.config.verbose { + eprintln!("printing diff:"); + let mut buf = Vec::new(); + diff_output.read_to_end(&mut buf).unwrap(); + std::io::stderr().lock().write_all(&mut buf).unwrap(); + } } match self.config.color { diff --git a/src/tools/miri b/src/tools/miri -Subproject c8713c2f9fc1e28c90876b9ec9557d8c5729757 +Subproject e5c3af6f516311cc4b1fc017c58d83b7442cbc3 |
