Docs.rs does not show my documentation

Hey guys, my crate's documentation is not shown on docs.rs (github, docs.rs).
Can anyone help me resolve this?
I am not that new to Rust, but I haven't had that problem ever.

I noticed that on the Builds section docs.rs built my crate as "nightly", even though I wrote it using stable.
Why is that?

Help is much appreciated!

1 Like

docs.rs always builds everything using its own nightly version of Rust. Nightly can compile all stable crates.

Does cargo doc build docs locally for you?

2 Likes

Yes, On my local machine (debian 11) it builds without problems.
Opening it in my browser (using cargo doc --open) also works as intended.

This discusson on zulip might be relevant to debugging the issue (link requires you to create a zulip account if you don't already have one). In particular, it sounds like docs.rs uses cargo rustdoc instead of cargo doc, which is apparently the same as running cargo doc --no-deps. So you may want to try running that locally if you haven't already.

2 Likes

Note that reading the discussion is possible through the archive, without an account:

https://zulip-archive.rust-lang.org/stream/122651-general/topic/Document.20crate.20as-if.20docs.2Ers.20would.html

3 Likes

Ok guys, thanks for the help, I got it fixed.

My crate provides derive macros (EnumMatch and EnumTake), thus my library is a proc-macro crate.
This requires to set proc-macro = true under [lib] in Cargo.toml. cargo also accepts proc_macro instead of proc-macro, but docs.rs does not. I had used proc_macro. I changed that to proc-macro and now version 0.1.1's documentation is shown.
github issue

Thanks for the help and have a great day!

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.