From: Bryant Mairs Date: Fri, 27 Jan 2017 17:54:43 +0000 (-0800) Subject: Clarify error for repo-based dependencies when publishing. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~11^2~8^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=450da94ecd955f2a95c72e9f403aa6da6357a7ea;p=cargo.git Clarify error for repo-based dependencies when publishing. Specifically add a description of how to resolve the error. --- diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index f3c8de934..e3492073f 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -81,9 +81,11 @@ fn verify_dependencies(pkg: &Package, registry_src: &SourceId) a version", dep.name()) } } else if dep.source_id() != registry_src { - bail!("all dependencies must come from the same source.\n\ - dependency `{}` comes from {} instead", - dep.name(), dep.source_id()) + bail!("crates cannot be published to crates.io with dependencies sourced from \ + a repository\neither publish `{}` as its own crate on crates.io and \ + specify a crates.io version as a dependency or pull it into this \ + repository and specify it with a path and version\n(crate `{}` has \ + repository path `{}`)", dep.name(), dep.name(), dep.source_id()); } } Ok(()) diff --git a/tests/publish.rs b/tests/publish.rs index cacf8faa4..fd3558a4e 100644 --- a/tests/publish.rs +++ b/tests/publish.rs @@ -115,8 +115,11 @@ fn git_deps() { .arg("--host").arg(registry().to_string()), execs().with_status(101).with_stderr("\ [UPDATING] registry [..] -[ERROR] all dependencies must come from the same source. -dependency `foo` comes from git://path/to/nowhere instead +[ERROR] crates cannot be published to crates.io with dependencies sourced from \ +a repository\neither publish `foo` as its own crate on crates.io and \ +specify a crates.io version as a dependency or pull it into this \ +repository and specify it with a path and version\n\ +(crate `foo` has repository path `git://path/to/nowhere`)\ ")); }