Open robamu opened 1 week ago
Actually, I have issue building this locally without warnings with current nightly.
Adding the following snippet to Cargo.toml
:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docs_rs)'] }
fixes the warning ,but the documentation still is not built properly.. In any case https://docs.rs/va108xx/0.3.0/va108xx/ shows the end result , with the documentation displaying where the rt
feature is required.
After some more research:
It is sufficient to use
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
in the lib.rs
. The docsrs
configuration will be set by docs-rs automatically.
In the Cargo.toml
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]
is sufficient now.
The old way I used to build this locally does not work anymore. I tested this locally using
RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc --all-features --open
the old way
cargo +nightly doc --all-features --config 'build.rustdocflags=["--cfg", "docsrs", "--generate-link-to-definition"]' --open
does not work anymore for some reason.
In my crates, I currently use the following code snippet at the top of
lib.rs
:For documentation built by docs.rs, this explicitly displays required features for modules/functions etc. without requiring additional attributes. What do you think about adding this to the generated library?
In all my libraries using this, I use the following snippets in
Cargo.toml
to use this for the docs-rs build: