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: //