Rustdoc Error: Current Crate Indistinguishable from Dependencies


#1

I’ve started getting an error when using travis to document a project of mine:

Documenting libc v0.2.8
Documenting serde v0.7.0
Documenting aster v0.14.0
Documenting quasi v0.8.0
error: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `libc` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two. [E0519]
Documenting rustc-serialize v0.3.18
Build failed, waiting for other jobs to finish...
error: Could not document `libc`.

Can someone give me an idea on where I should look to fix this?


#2

Sounds like a circular dependency?


#3

It does rather, I get the same error if I clone libc and attempt to build on rustc 1.9.0-nightly (d5a91e695 2016-03-26):

   Compiling libc v0.2.8 (file:///Volumes/Data/src/libc)
     Running `rustc src/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"use_std\" --cfg feature=\"default\" --out-dir /Volumes/Data/src/libc/target/debug --emit=dep-info,link -L dependency=/Volumes/Data/src/libc/target/debug -L dependency=/Volumes/Data/src/libc/target/debug/deps`
error: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `libc` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two. [E0519]
error: Could not compile `libc`.

But when compiled as a dependency somewhere upstream in my project it does build… Just not when documenting. I’m guessing rustdoc attempts to compile too?


#4

There were some changes related to cargo metadata in the nightly version(may be even beta), I am curious if it is not a regression.
@alexcrichton @matklad Do you think this rings a bell? Or it’s unrelated?

At the same time, docs for libc have been generated for a while by other projects, don’t know…


#5

I think that the error message is about the different kind of metadata (metadata subcommand vs this metadata ).

The metadata subcommand is already included in beta, this can be used to rule out the possibility of this subcommand being the culprit here. And I doubt that this subcommand affects compilation in any way: it is purely a CLI tool for getting information about the project in JSON, none of the internals were changed.


#6

It’s a known regression: https://github.com/rust-lang/rust/issues/32532