-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add an unstable --output-format option to cargo rustdoc #12103
Copy link
Copy link
Closed
Labels
C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewT-cargoTeam: CargoTeam: Cargodisposition-mergeFCP with intent to mergeFCP with intent to mergefinished-final-comment-periodFCP completeFCP complete
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewT-cargoTeam: CargoTeam: Cargodisposition-mergeFCP with intent to mergeFCP with intent to mergefinished-final-comment-periodFCP completeFCP complete
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
rustdoc(on nightly) exposes an--output-formatoption to choose the format of the generated documentation: either HTML (the default) or JSON (the new unstable backend).If you choose the JSON format, the output file of the unit is no longer
/target/doc/<crate_name>/index.html; it becomes/target/doc/<crate name>.json.Since there is no way to specify the output format as an option of
cargo rustdocitself,cargoassumes that the only possible output path for a doc unit is the HTML one. As a consequence, the JSON output is never considered "fresh" and we miss out on caching (see the test case in #12100, which fails onmaster).Proposed Solution
Since
cargomust remain unaware of the semantics ofrustdoc's extra arguments, I suggest we add--output-formatas an unstablecargo rustdocargument, mimicking the semantics of the underlying--output-formatoption forrustdoc.This would allow
cargoto reason about it and take it into account in the fingerprinting logic.Notes
No response