Skip to content

Commit a22a7db

Browse files
committed
Pass --extern-private or --extern, but not both
1 parent e578fc1 commit a22a7db

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,14 +1006,24 @@ fn build_deps_args<'a, 'cfg>(
10061006
v.push(cx.files().out_dir(dep));
10071007
v.push(&path::MAIN_SEPARATOR.to_string());
10081008
v.push(&output.path.file_name().unwrap());
1009-
cmd.arg("--extern").arg(&v);
1009+
1010+
let mut private = false;
10101011

10111012
if current.pkg.manifest().features().require(Feature::public_dependency()).is_ok() {
10121013
if !bcx.is_public_dependency(current, dep) {
1013-
cmd.arg("--extern-private").arg(&v);
1014-
*need_unstable_opts = true
1014+
private = true;
10151015
}
10161016
}
1017+
1018+
if private {
1019+
cmd.arg("--extern-private");
1020+
} else {
1021+
cmd.arg("--extern");
1022+
}
1023+
1024+
cmd.arg(&v);
1025+
*need_unstable_opts |= private;
1026+
10171027
}
10181028
Ok(())
10191029
}

0 commit comments

Comments
 (0)