Skip to content

Commit f529ba8

Browse files
committed
Add docsrs feature gating
As we do in `rust-bitcoin` add a compiler conditional configuration option `docsrs` to add feature gating to the docrs build. Fix and improve the rustdocs while we are at it. Add docs build to CI script but do not enable it in the github actions yet. Fix: rust-bitcoin#75
1 parent 45d16db commit f529ba8

File tree

2 files changed

+126
-56
lines changed

2 files changed

+126
-56
lines changed

contrib/test.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ if [ "$DO_FMT" = true ]; then
3232
cargo fmt --check
3333
fi
3434

35+
# Build the docs if told to (this only works with the nightly toolchain)
36+
if [ "$DO_DOCSRS" = true ]; then
37+
RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +nightly doc --all-features
38+
fi
39+
40+
# Build the docs with a stable toolchain, in unison with the DO_DOCSRS command
41+
# above this checks that we feature guarded docs imports correctly.
42+
if [ "$DO_DOCS" = true ]; then
43+
RUSTDOCFLAGS="-D warnings" cargo +stable doc --all-features
44+
fi
45+
3546
# Check without features.
3647
cargo build --no-default-features
3748
cargo test --no-default-features

0 commit comments

Comments
 (0)