From 56064d5f4ed1a9f27b5fb17ba34dfb299e596da3 Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 27 Jan 2024 19:15:10 -0500 Subject: [PATCH] don't pass `-L .../auxiliary` unless it exists this avoids warnings from macOS ld --- src/tools/compiletest/src/runtest.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 25a135aa32027..93f020fc3e4ef 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1058,6 +1058,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(); @@ -1612,7 +1616,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);