Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc fails with info about symbol names #32532

Closed
alexcrichton opened this issue Mar 27, 2016 · 15 comments · Fixed by #32560
Closed

Rustdoc fails with info about symbol names #32532

alexcrichton opened this issue Mar 27, 2016 · 15 comments · Fixed by #32560
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

A bunch of my nightly builds are now generating the error:

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]

This is likely due to the revamp of symbol names, but it's also unfortunately a regression on nightly. I think what's happening here is that Cargo isn't passing -C metadata to rustdoc (because it can't) and then the crates.io libc crate is conflicting with the in-tree libc crate.

cc @nikomatsakis

@alexcrichton alexcrichton added I-nominated regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 27, 2016
@alexcrichton
Copy link
Member Author

Ah, and an example of a failing build

@brson
Copy link
Contributor

brson commented Mar 28, 2016

I'm hitting this too.

brson added a commit to rust-lang/rustup that referenced this issue Mar 28, 2016
brson added a commit to rust-lang/rustup that referenced this issue Mar 28, 2016
@nikomatsakis
Copy link
Contributor

cc @michaelwoerister

@nikomatsakis
Copy link
Contributor

@brson specifically with libc, or with other crate names?

@nikomatsakis
Copy link
Contributor

So I'm trying to figure out if the right answer here is that we should just be passing in metadata to rustdoc? Seems plausible.

@michaelwoerister
Copy link
Member

Hm, in rustdoc we actually don't care about symbol name conflict, so we could indicate that to the crate loader?

@michaelwoerister
Copy link
Member

The analysis of the underlying reason by @alexcrichton seems plausible to me, by the way.

@nikomatsakis
Copy link
Contributor

Hm, in rustdoc we actually don't care about symbol name conflict, so we could indicate that to the crate loader?

Maybe, but it seems sloppy to me -- I mean, why don't we care? The signatures might well be different, for example, so it might well matter. In any case, I'm trying to understand what is leading us to get this conflict still (I haven't reproduced it yet -- what target do I need to use?).

The analysis of the underlying reason by @alexcrichton seems plausible to me, by the way.

I feel like I'm still missing something. From what I can tell, the error comes when generating docs for the libc crate -- so why is it accessing crates.io anyway? And doesn't crates.io give metadata when building? (Do we tell rustdoc where to find all dependencies the same way we tell rustc? I would expect so...but maybe it's falling back to some other behavior and scraping things off the file system?)

Perhaps part of it is that I am a bit removed from the details of how a lot of this lower level stuff works.

@nikomatsakis
Copy link
Contributor

ok, I see now that this error is not when bootstrapping.

@nikomatsakis
Copy link
Contributor

Further investigation reveals that somehow we do not seem to be supplying -C metadata except for tests. Oops. That will presumably fix this conflict, though not in the best possible way -- because now the makefile libc will have a disambiguator, so the rustdoc version would have a disambiguator of just "" and everybody is happy.

That said, it seems to me that rustdoc should take a -C metadata argument -- presumably it should take the same arguments as rustc, since it basically invokes rustc.

@michaelwoerister
Copy link
Member

Cargo isn't passing -C metadata to rustdoc (because it can't)

@alexcrichton Can you elaborate on that?

@alexcrichton
Copy link
Member Author

I believe this is fixed in #32560, explained here: #32560 (comment).

To elaborate on the lack of metadata, rustdoc simply doesn't accept -C flags, so that's why it's not being passed :)

bors added a commit that referenced this issue Mar 28, 2016
…tsakis

mk: Add `-C metadata` for compiling crates we ship

This should re-enable all external builds of crates with the same name. Right
now Cargo doesn't pass `-C metadata` for the top-level library being compiled,
so if that library is called `libc`, for example, then it won't be able to link
to the standard library which *also* has a `libc` library compiled without `-C
metadata`. This can result in naming conflicts which need to be resolved.

By passing `-C metadata` to the in-tree crates we ship it should add some extra
salt to all symbol names to ensure that they don't collide.

Closes #32532
@nikomatsakis
Copy link
Contributor

@alexcrichton did you actually check whether this is fixed? I wonder if it's worth trying to allow rustdoc to accept -C metadata -- I guess so long as it doesn't matter, it doesn't matter.

@alexcrichton
Copy link
Member Author

Nah I was hoping to test with today's nightly, but that's blocked on #32568. I'm pretty confident that the change would fix this, however.

@paukul
Copy link

paukul commented Mar 30, 2016

FYI rustc 1.9.0-nightly (b678600 2016-03-29) fixed this issue for me

mattico added a commit to mattico/rustup.rs that referenced this issue May 12, 2017
rust-lang/rust#32532 is fixed, so this might work now. Let's find out.
bors added a commit to rust-lang/rustup that referenced this issue May 18, 2017
Re-enable doc uploading on travis

rust-lang/rust#32532 is fixed, so this might work now. Let's find out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants