about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorjyn <rust@jyn.dev>2024-01-27 19:15:10 -0500
committerjyn <github@jyn.dev>2024-10-27 21:23:28 -0400
commit675f447d886ea4cf1c3d0e39676cd3bf36cf88ba (patch)
tree571e2b83f6c094d1c80a9d181e52c47634757c77 /src
parentf1e5b365f07975c63e2116973a0ed85e251ebe17 (diff)
downloadrust-675f447d886ea4cf1c3d0e39676cd3bf36cf88ba.tar.gz
rust-675f447d886ea4cf1c3d0e39676cd3bf36cf88ba.zip
don't pass `-L .../auxiliary` unless it exists
this avoids warnings from macOS ld
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/runtest.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3a6eca7dc5d..a8a71c196fc 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1096,6 +1096,10 @@ impl<'test> TestCx<'test> {
         self.config.target.contains("vxworks") && !self.is_vxworks_pure_static()
     }
 
+    fn has_aux_dir(&self) -> bool {
+        !self.props.aux.builds.is_empty() || !self.props.aux.crates.is_empty()
+    }
+
     fn aux_output_dir(&self) -> PathBuf {
         let aux_dir = self.aux_output_dir_name();
 
@@ -1649,7 +1653,11 @@ impl<'test> TestCx<'test> {
         }
 
         if let LinkToAux::Yes = link_to_aux {
-            rustc.arg("-L").arg(self.aux_output_dir_name());
+            // if we pass an `-L` argument to a directory that doesn't exist,
+            // macOS ld emits warnings which disrupt the .stderr files
+            if self.has_aux_dir() {
+                rustc.arg("-L").arg(self.aux_output_dir_name());
+            }
         }
 
         rustc.args(&self.props.compile_flags);