Enable crate feature info in rustdocs #371
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #360 (comment)
The
doc_cfg
anddoc_auto_cfg
features are described in rust-lang/rust#90502 and enable rustdocs to render uses of#[cfg(feature = ...])
. These features are enabled using a cfg attributedocsrs
which is enabled in Cargo.toml for docs.rs. Sincedoc_cfg
anddoc_auto_cfg
are unstable features, thisdocsrs
attribute is left disabled by default. It can also be enabled on the command-line as in the following command to build the docs using a nightly toolchain (Runrustup update nightly
first if you haven't installed nightly recently):RUSTDOCFLAGS='--cfg docsrs' cargo +nightly doc --no-deps --features secp256r1,secp256k1,ripemd-160,http-did
After building docs with that command, open
target/doc/ssi/hash/fn.sha256.html
:Features secp256r1,secp256k1,ripemd-160,http-did are set as enabled by default for the docs.rs build (from 883f3c4 in #311).
I combined the two sha256 function implementations into one function, as I wasn't otherwise able to get the docs to list its supported crate features as "sha2 or ring". (Similar: rust-lang/rust#90497 (comment))