Skip to content

Enable doc_cfg and doc_auto_cfg for all [features] crates on https://docs.rs#293

Merged
MarijnS95 merged 1 commit intomasterfrom
doc-cfg
Jul 5, 2022
Merged

Enable doc_cfg and doc_auto_cfg for all [features] crates on https://docs.rs#293
MarijnS95 merged 1 commit intomasterfrom
doc-cfg

Conversation

@MarijnS95
Copy link
Member

The documentation currently doesn't expose what features a user needs to enable before certain functionality becomes available, requiring them to look at the sourcecode as we don't really provide much documentation or guideance towards this.

That's totally fine because it is a job for rustdoc, one that it performs very well when the experimental doc_cfg feature is enabled, and specifically doc_auto_cfg to not have to manually re-specify every #[cfg(<guard>)] within a #[cfg_attr(docs_rs, doc(cfg(<guard>)))].

docs.rs builds on nightly which makes this possible, and docs can be built with the docsrs cfg enabled locally to see the result, e.g.:

RUSTDOCFLAGS="-Dwarnings --cfg docsrs" cargo +nightly doc --no-deps --workspace --target aarch64-linux-android --all-features --document-private-items --open

…tps://docs.rs

The documentation currently doesn't expose what features a user needs to
enable before certain functionality becomes available, requiring them to
look at the sourcecode as we don't really provide much documentation or
guideance towards this.

That's totally fine because it is a job for `rustdoc`, one that it
performs very well when the experimental `doc_cfg` feature is enabled,
and specifically `doc_auto_cfg` to not have to manually re-specify every
`#[cfg(<guard>)]` within a `#[cfg_attr(docs_rs, doc(cfg(<guard>)))]`.

docs.rs builds on `nightly` which makes this possible, and docs can be
built with the `docsrs` cfg enabled locally to see the result, e.g.:

    RUSTDOCFLAGS="-Dwarnings --cfg docsrs" cargo +nightly doc --no-deps --workspace --target aarch64-linux-android --all-features --document-private-items --open
@MarijnS95
Copy link
Member Author

The module, for example:

image

@MarijnS95 MarijnS95 merged commit 3528ed8 into master Jul 5, 2022
@MarijnS95 MarijnS95 deleted the doc-cfg branch July 5, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants