diff --git a/src/cargo/core/compiler/context/compilation_files.rs b/src/cargo/core/compiler/context/compilation_files.rs index 29afdcbf7bc..a2e91ef7acd 100644 --- a/src/cargo/core/compiler/context/compilation_files.rs +++ b/src/cargo/core/compiler/context/compilation_files.rs @@ -210,7 +210,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { // we don't want to link it up. if out_dir.ends_with("deps") { // Don't lift up library dependencies - if self.roots.contains(unit) { + if unit.target.is_bin() || self.roots.contains(unit) { Some(( out_dir.parent().unwrap().to_owned(), if unit.mode.is_any_test() {