Auto merge of #4550 - lukaslueg:issue4539, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 30 Sep 2017 08:05:10 +0000 (08:05 +0000)
committerbors <bors@rust-lang.org>
Sat, 30 Sep 2017 08:05:10 +0000 (08:05 +0000)
Improve error ico doc-targets with same name

Replace the `assert!` that was triggered in #4539 with a `bail!`, giving the user a clear error that points to the offending packages. The error message now looks like

> The binary `foo_cli` is specified by packages `foo (file://...)` and `bar (file://...)` but can be documented only once. Consider renaming or marking one of the targets as `doc = false`.

or

> The library `foo_cli` is specified by packages `foo (file://...)` and `bar (file://...)` ...

or

> The target `foo_cli` is specified as a library and as a binary by package `foo (file://...)`. It can be documented only once. Consider...

or

> The target `foo_cli` is specified as a library by package `foo (file://...)` and as a binary by package `bar (file://...)`. It can be ...

Add unit-test for all cases, including one that ensures the advertised mitigation `doc = false` actually works.


Trivial merge