From 0726b2c4799fb31705aa8c488209dd865a8fe851 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 6 Nov 2023 08:06:23 -0800 Subject: [PATCH] Enable feature(doc_cfg) during docs.rs documentation build --- serde/Cargo.toml | 2 +- serde/src/lib.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/serde/Cargo.toml b/serde/Cargo.toml index b1a6d3e9..bb7b60b1 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -29,7 +29,7 @@ features = ["derive", "rc"] [package.metadata.docs.rs] features = ["derive"] targets = ["x86_64-unknown-linux-gnu"] -rustdoc-args = ["--generate-link-to-definition"] +rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"] # This cfg cannot be enabled, but it still forces Cargo to keep serde_derive's # version in lockstep with serde's, even if someone depends on the two crates diff --git a/serde/src/lib.rs b/serde/src/lib.rs index 8c6a4aff..214fd5bd 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -98,6 +98,8 @@ #![doc(html_root_url = "https://docs.rs/serde/1.0.190")] // Support using Serde without the standard library! #![cfg_attr(not(feature = "std"), no_std)] +// Show which crate feature enables conditionally compiled APIs in documentation. +#![cfg_attr(doc_cfg, feature(doc_cfg))] // Unstable functionality only if the user asks for it. For tracking and // discussion of these features please refer to this issue: //