If you want to read the docs for a Rust project that isn't on crates.io (such as the main branch on github) you can clone the repo, then run cargo doc
. For example, with SWC (which is a workspace), we can run
git clone https://github.com/swc-project/swccd swccargo doc --workspace
In some cases you'll run into an experimental feature in a dependency's docs, such as this one from serde, a dependency of swc (which uses nightly rust).
❯ cargo doc --workspaceDocumenting serde v1.0.125Documenting swc_visit v0.2.4 (/Users/chris/tmp/swc/visit)error[E0658]: linking to associated items of raw pointers is experimental|= note: see issue #80896 <https://github.com/rust-lang/rust/issues/80896> for more information= help: add `#![feature(intra_doc_pointers)]` to the crate attributes to enable= note: rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it doeserror: aborting due to previous errorFor more information about this error, try `rustc --explain E0658`.error: could not document `serde`
To work around this, since we don't really need serde's documentation to be generated, we can use --no-deps
. We can also use --open
to open the generated documentation.
cargo doc --workspace --no-deps --open