]> git.proxmox.com Git - cargo.git/commitdiff
Auto merge of #4515 - lukaslueg:issue1006, r=alexcrichton
authorbors <bors@rust-lang.org>
Thu, 21 Sep 2017 15:26:09 +0000 (15:26 +0000)
committerbors <bors@rust-lang.org>
Thu, 21 Sep 2017 15:26:09 +0000 (15:26 +0000)
Improve message for multiple links to native lib

Proposal for a fix to #1006, as advertised in my comment; as discussed briefly with alexcrichton on IRC.

In case multiple packages link to the same library, the error message is now

> error: More than one package links to native library `a`, which can only be linked once.
>
> Package a-sys v0.5.0 (file:///home/lukas/dev/issue1006test/a) links to native library `a`.
> (Dependency via foo v0.5.0 (file:///home/lukas/dev/issue1006test))
>
> Package b-sys v0.5.0 (file:///home/lukas/dev/issue1006test/a/b) also links to native library `a`.
> (Dependency via a-sys v0.5.0 (file:///home/lukas/dev/issue1006test/a) => foo v0.5.0 (file:///home/lukas/dev/issue1006test))
>
> Try updating or pinning your dependencies to ensure that native library `a` is only linked once.
>

In case the root-package itself is an offender:

> Package foo v0.5.0 (file:///home/lukas/dev/issue1006test) links to native library `a`.
> (This is the root-package)
>

IMHO the wording is much clearer now (the term "native library" and "package" are repeated on purpose); printing the whole dependency-chain from the offending package up to the root allows the user to at least figure out where the native library actually comes in.

Added a unit-test, which all pass. Please scrutinize this carefully, it's my first PR for cargo.


Trivial merge