From 24920043d3ff766d89909420da867e7917ae2ba2 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 2 Aug 2024 17:27:59 +0700 Subject: [PATCH] Enable `feature(doc_auto_cfg)` for docs.rs (#359) 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 --- .github/workflows/ci.yml | 2 ++ src/lib.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 297cc7f4..b94b9bd9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/src/lib.rs b/src/lib.rs index b5088b4e..70c7e6e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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")))]