Skip to content

Commit 2e15c80

Browse files
committed
Make host libs -L flag optional
1 parent cea46dd commit 2e15c80

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/compile-test.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn extern_flags() -> String {
104104
}
105105
crates
106106
.into_iter()
107-
.map(|(name, path)| format!("--extern {}={} ", name, path))
107+
.map(|(name, path)| format!(" --extern {}={}", name, path))
108108
.collect()
109109
}
110110

@@ -126,10 +126,13 @@ fn default_config() -> compiletest::Config {
126126
// Using `-L dependency={}` enforces that external dependencies are added with `--extern`.
127127
// This is valuable because a) it allows us to monitor what external dependencies are used
128128
// and b) it ensures that conflicting rlibs are resolved properly.
129+
let host_libs = option_env!("HOST_LIBS")
130+
.map(|p| format!(" -L dependency={}", Path::new(p).join("deps").display()))
131+
.unwrap_or_default();
129132
config.target_rustcflags = Some(format!(
130-
"--emit=metadata -L dependency={} -L dependency={} -Dwarnings -Zui-testing {}",
131-
host_lib().join("deps").display(),
133+
"--emit=metadata -Dwarnings -Zui-testing -L dependency={}{}{}",
132134
deps_path.display(),
135+
host_libs,
133136
extern_flags(),
134137
));
135138

0 commit comments

Comments
 (0)