-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: builds including multiple crates with the same name are always dirty #61378
Comments
This is because the dependency tree has both "futures-preview" and "futures". "futures-preview" has a I can't think of any good solutions. Fundamentally rustdoc would need to organize crate directory names differently, but I can't think of a way that isn't awful (like |
Why is |
I think proper cross-crate linking will be more complicated. When rustdoc resolves a path to the I don't really know much about rustdoc so I'm not really the right person to ask. People more familiar with it may have better ideas. Perhaps it's not so difficult. |
TBH I don't care even as much if they're broken and one crate overwrites another-- that would still be more workable than the current status quo where that happens and the doc builds are always dirty, forcing a full rebuild every time. |
I thought it was handled on |
Not really. It checks for documenting duplicate workspace crates, and raises an error, but it doesn't check for duplicate dependencies. I posted a PR yesterday to issue a warning for duplicate dependencies (rust-lang/cargo#6998), to at least make it easier to discover/debug this. But issuing errors or warnings isn't really a good user experience. In all of these cases, it would be nice if rustdoc could support duplicate crate names. But as I mentioned, it seems tricky, since there would need to be a new directory layout, and cargo would need to pass extra information to rustdoc to inform it the additional information to distinguish them (such as package name and version, not sure if there are other components necessary). And I'm not sure if rustdoc can fundamentally handle multiple crates with the same name. I would imagine the sidebar and the search index might struggle with it. |
It's not supposed to... The only thing we could do is to change the crate name of the dependencies by adding the version/commit. Like this, we would be able to build the search index. |
Catch filename output collisions in rustdoc. This does some general cleanup so that rustdoc output is computed correctly. This allows the collision detection code to work. There are some known issues with rustdoc creating collisions (rust-lang/rust#61378, rust-lang/rust#56169). This is related to issue #6313. This includes a change that `CompileMode::is_doc` no longer returns `true` for doc tests. This has bothered me for a while, as various points in the code was not handling it correctly. Separating it into `is_doc` and `is_doc_test` I think is better and more explicit. Note for reviewing: There is a big diff in `calc_outputs`, but this is just rearranging code. Everything in `calc_outputs_rustc` is unchanged from the original. The only functional changes should be: - A warning is emitted for colliding rustdoc output. - Don't create an empty fingerprint directory for doc tests.
Whenever rustdoc tries to link to another crate, it calls the function rust/src/librustdoc/html/render.rs Lines 1378 to 1407 in 991c719
So any alternate name we would choose would have to make its way there. Looking at it again, it looks like passing I did some testing, and here are some notes:
|
I haven't figured out exactly what's going on here yet, but to repro:
(tested on
rustc 1.36.0-nightly (a784a8022 2019-05-09)
)The second
cargo doc
should do no work and immediately exit, however it instead proceeds to documenttokio-io
and everything after it. This only happens when theio-compat
feature is enabled, but does not happen when depending directly ontokio-io
.The text was updated successfully, but these errors were encountered: