Skip to content

Commit

Permalink
Enable feature(doc_auto_cfg) for docs.rs (#359)
Browse files Browse the repository at this point in the history
Docs built using this (like for docs.rs) will show what feature must be
enabled for things that are `cfg(feature = ...)` gated.

This is a nightly only thing. If you want to run it locally, you can
use:

    RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
  • Loading branch information
waywardmonkeys committed Aug 2, 2024
1 parent f512d6e commit 2492004
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ jobs:
# We test documentation using nightly to match docs.rs. This prevents potential breakages
- name: cargo doc
run: cargo doc --workspace --locked --all-features --no-deps --document-private-items -Zunstable-options -Zrustdoc-scrape-examples
env:
RUSTDOCFLAGS: '--cfg docsrs'

# If this fails, consider changing your text or adding something to .typos.toml
typos:
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
clippy::excessive_precision,
clippy::bool_to_int_with_if
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]

#[cfg(not(any(feature = "std", feature = "libm")))]
Expand Down

0 comments on commit 2492004

Please sign in to comment.