-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 should be able to build documentation from compiled crates #2206
Comments
Part of #5413, I suppose. |
This is not yet implemented by rustdoc_ng. |
Low, not 1.0 |
Note that all of the infrastructure is in place for doing this, there's just a few more wires to put in place. |
This commit uses an existing foreign inlining facility to implement the doc generation from compiled crates. At the highest level, this is a *huge* hack since the metadata doesn't provide everything we need to generate docs. Fixes rust-lang#2206. Will fix rust-lang#15309 once integrated with Makefile.
Triage bump: Still an issue. Priorities and tags seem correct to me. (cc @steveklabnik to make sure he's notified when things change here) |
Triage: no changes here. |
Triage: no changes, but this is certainly desired, especially with |
I think
and documenting also shares the same metadata cache as checking:
I guess my question is what this would be useful for? It seems weird to want to document a crate without having the source available. Rustdoc also has a bunch of subtle bugs about how metadata handling is different from HIR handling, which would suddenly start applying to the main crate instead of only on re-exports: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+crate+label%3AA-cross-crate-reexports |
But it does still require compiling every crate twice. Once for crate metadata to be used when documenting crates that depend on the current crate and once to actually generate documentation for the current crate.
Could be useful for closed-source crates. And as a side-effect clearly show just how much information is leaked in the crate metadata, which could help dissuade people from releasing crates as closed source rlibs that can then only be used by a single rustc version. And instead push them towards either making it source available or releasing it as a cdylib with a stable abi such that it can be used with any rustc version. |
Having a tool for this seems useful, but I don't know that rustdoc needs to be that tool. Rustdoc has already had several major expansions of scope. Given the complexity of the implementation, the fact it will likely change various parts of the rendering (https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+crate+label%3AA-cross-crate-reexports), and the unclear use cases, I think this would benefit from an RFC that explains why this functionality belongs in rustdoc. |
rustdocs are built from attributes which are (should be) stored in the crate metadata. rustdoc should be able to construct the crate documentation from the crate metadata with nearly the same fidelity as from the original source.
Update(2024, fmease): In today's terms, this essentially asks for the option1 to build docs based on
rustc_middle::ty
instead of the HIR in the all cases, not just for inlined cross-crate re-exports and synthetic impls.Footnotes
Some t-rustdoc members (incl. myself, @fmease) are even inclined to drop "HIR cleaning" entirely once the important A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crate
issues have been addressed (which is non-trivial I have to add). In the long term, that move would greatly improve the correctness of rustdoc and make it easier to develop certain features. Namely anything that depends on more complex "type-based reasoning" (for which
rustc_middle::ty
is a lot better suited compared to the HIR). ↩The text was updated successfully, but these errors were encountered: