]> git.proxmox.com Git - cargo.git/commitdiff
Pass --extern-private or --extern, but not both
authorAaron Hill <aa1ronham@gmail.com>
Tue, 23 Apr 2019 19:48:55 +0000 (15:48 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Fri, 26 Apr 2019 02:42:19 +0000 (22:42 -0400)
src/cargo/core/compiler/mod.rs

index 249d20003787000631d7b1d919ec8acfe91f5795..fe80d1fc7583d916465b5a0f016f5ece50bb0937 100644 (file)
@@ -1006,14 +1006,24 @@ fn build_deps_args<'a, 'cfg>(
             v.push(cx.files().out_dir(dep));
             v.push(&path::MAIN_SEPARATOR.to_string());
             v.push(&output.path.file_name().unwrap());
-            cmd.arg("--extern").arg(&v);
+
+            let mut private = false;
 
             if current.pkg.manifest().features().require(Feature::public_dependency()).is_ok() {
                 if !bcx.is_public_dependency(current, dep) {
-                    cmd.arg("--extern-private").arg(&v);
-                    *need_unstable_opts = true
+                    private = true;
                 }
             }
+
+            if private {
+                cmd.arg("--extern-private");
+            } else {
+                cmd.arg("--extern");
+            }
+
+            cmd.arg(&v);
+            *need_unstable_opts |= private;
+
         }
         Ok(())
     }