Skip to content

Commit 581da42

Browse files
committed
Don't add sysroot lib path to dylib path for build-std.
1 parent d0ab04a commit 581da42

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cargo/core/compiler/compilation.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,13 @@ impl<'cfg> Compilation<'cfg> {
203203
super::filter_dynamic_search_path(self.native_dirs.iter(), &self.root_output);
204204
search_path.push(self.deps_output.clone());
205205
search_path.push(self.root_output.clone());
206-
search_path.push(self.target_dylib_path.clone());
206+
// For build-std, we don't want to accidentally pull in any shared
207+
// libs from the sysroot that ships with rustc. This may not be
208+
// required (at least I cannot craft a situation where it
209+
// matters), but is here to be safe.
210+
if self.config.cli_unstable().build_std.is_none() {
211+
search_path.push(self.target_dylib_path.clone());
212+
}
207213
search_path
208214
};
209215

0 commit comments

Comments
 (0)