about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-04 19:38:09 +0000
committerbors <bors@rust-lang.org>2023-06-04 19:38:09 +0000
commit101fa903bb9209d270086da279247625a2869211 (patch)
tree6d6bf71eb8fd86c34746171f300bf28c85e4bfdb
parentdc25fbe9844f4c8bddc316685d270a49d7b159b9 (diff)
parent0716ac9bff804970b0e6326ce943ad70019a6bff (diff)
downloadrust-101fa903bb9209d270086da279247625a2869211.tar.gz
rust-101fa903bb9209d270086da279247625a2869211.zip
Auto merge of #112282 - matthiaskrgr:rollup-1g9w02p, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #112247 (rust-lld: add rpath entry to the correct `lib` folder)
 - #112274 (Migrate GUI colors test to original CSS color format)
 - #112277 (Don't require the output from libtest to be valid UTF-8)

Failed merges:

 - #112251 (rustdoc: convert `if let Some()` that always matches to variable)

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--src/bootstrap/llvm.rs25
-rw-r--r--src/bootstrap/render_tests.rs11
-rw-r--r--src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version2
-rw-r--r--tests/rustdoc-gui/sidebar-mobile.goml12
4 files changed, 38 insertions, 12 deletions
diff --git a/src/bootstrap/llvm.rs b/src/bootstrap/llvm.rs
index 3fd0cca40e5..19e595650cf 100644
--- a/src/bootstrap/llvm.rs
+++ b/src/bootstrap/llvm.rs
@@ -834,6 +834,31 @@ impl Step for Lld {
             }
         }
 
+        // LLD is built as an LLVM tool, but is distributed outside of the `llvm-tools` component,
+        // which impacts where it expects to find LLVM's shared library. This causes #80703.
+        //
+        // LLD is distributed at "$root/lib/rustlib/$host/bin/rust-lld", but the `libLLVM-*.so` it
+        // needs is distributed at "$root/lib". The default rpath of "$ORIGIN/../lib" points at the
+        // lib path for LLVM tools, not the one for rust binaries.
+        //
+        // (The `llvm-tools` component copies the .so there for the other tools, and with that
+        // component installed, one can successfully invoke `rust-lld` directly without rustup's
+        // `LD_LIBRARY_PATH` overrides)
+        //
+        if builder.config.rpath_enabled(target)
+            && util::use_host_linker(target)
+            && builder.config.llvm_link_shared()
+            && target.contains("linux")
+        {
+            // So we inform LLD where it can find LLVM's libraries by adding an rpath entry to the
+            // expected parent `lib` directory.
+            //
+            // Be careful when changing this path, we need to ensure it's quoted or escaped:
+            // `$ORIGIN` would otherwise be expanded when the `LdFlags` are passed verbatim to
+            // cmake.
+            ldflags.push_all("-Wl,-rpath,'$ORIGIN/../../../'");
+        }
+
         configure_cmake(builder, target, &mut cfg, true, ldflags, &[]);
         configure_llvm(builder, target, &mut cfg);
 
diff --git a/src/bootstrap/render_tests.rs b/src/bootstrap/render_tests.rs
index 872b75f6c15..06ab820953d 100644
--- a/src/bootstrap/render_tests.rs
+++ b/src/bootstrap/render_tests.rs
@@ -88,10 +88,10 @@ impl<'a> Renderer<'a> {
     }
 
     fn render_all(mut self) {
-        let mut line = String::new();
+        let mut line = Vec::new();
         loop {
             line.clear();
-            match self.stdout.read_line(&mut line) {
+            match self.stdout.read_until(b'\n', &mut line) {
                 Ok(_) => {}
                 Err(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => break,
                 Err(err) => panic!("failed to read output of test runner: {err}"),
@@ -100,12 +100,13 @@ impl<'a> Renderer<'a> {
                 break;
             }
 
-            match serde_json::from_str(&line) {
+            match serde_json::from_slice(&line) {
                 Ok(parsed) => self.render_message(parsed),
                 Err(_err) => {
                     // Handle non-JSON output, for example when --nocapture is passed.
-                    print!("{line}");
-                    let _ = std::io::stdout().flush();
+                    let mut stdout = std::io::stdout();
+                    stdout.write_all(&line).unwrap();
+                    let _ = stdout.flush();
                 }
             }
         }
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
index 3ccca1e8b89..413b31282f7 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
@@ -1 +1 @@
-0.16.5
\ No newline at end of file
+0.16.6
\ No newline at end of file
diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml
index 3b022c7e9d0..4b8337ace3a 100644
--- a/tests/rustdoc-gui/sidebar-mobile.goml
+++ b/tests/rustdoc-gui/sidebar-mobile.goml
@@ -73,16 +73,16 @@ define-function: (
 
 call-function: ("check-colors", {
     "theme": "ayu",
-    "color": "rgb(197, 197, 197)",
-    "background": "rgb(20, 25, 31)",
+    "color": "#c5c5c5",
+    "background": "#14191f",
 })
 call-function: ("check-colors", {
     "theme": "dark",
-    "color": "rgb(221, 221, 221)",
-    "background": "rgb(80, 80, 80)",
+    "color": "#ddd",
+    "background": "#505050",
 })
 call-function: ("check-colors", {
     "theme": "light",
-    "color": "rgb(0, 0, 0)",
-    "background": "rgb(245, 245, 245)",
+    "color": "black",
+    "background": "#F5F5F5",
 })