-
Notifications
You must be signed in to change notification settings - Fork 13.4k
rustdoc-json: multiple package versions clobber their output paths #142370
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
Comments
Doesn't the same happen for the html docs? |
Yes, the same happens to HTML docs, but the trade-offs are different for JSON. JSON is consumed by tooling like I think for tooling a relatively simple and robust solution would be to place the json files next to their
and could write:
These |
My top concern is not accidentally blocking the work on cross-crate rustdoc JSON linking by a change made here. At RustWeek we discussed a variety of options about that, some of which also involved From |
Naming collisions in
Having said all that, I agree with @obi1kenobi—I believe we should strive for a structural solution that we aim to stabilize, while taking into account the other ambiguity issue we're dealing with in Specifically on the |
Uh oh!
There was an error while loading. Please reload this page.
Rustdoc uses crate name as a base for file names (
target/doc/$name.json
), but this naming scheme is incompatible with Cargo projects where names are not unique, and multiple different crates can have the same name.RUSTDOCFLAGS="-Z unstable-options --output-format=json" cargo +nightly doc
This ends up writing
target/doc/wild.json
for only one of the two versions. The same problem can happen if Cargo hasgit
,path
, or custom registry dependencies that use names overlapping with crates-io dependencies, so even name + version isn't unique.Using the package alias (
new
andold
in this example) wouldn't be sufficient, because these aliases aren't globally unique either. Different crates in the same dependency tree can rename different deps to the same name.cargo 1.89.0-nightly (fc1518ef0 2025-06-06)
The text was updated successfully, but these errors were encountered: