Skip to content

Commit 51f5b26

Browse files
committed
Show required features in the docs on docs.rs
Currently, this is nightly-only feature See https://stackoverflow.com/questions/61417452
1 parent b456b5a commit 51f5b26

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ serialize = ["serde"]
102102
escape-html = []
103103

104104
[package.metadata.docs.rs]
105+
# document all features
105106
all-features = true
107+
# defines the configuration attribute `docs_rs` to enable feature requirements
108+
# See https://stackoverflow.com/questions/61417452
109+
rustdoc-args = ["--cfg", "docs_rs"]
106110

107111
[[test]]
108112
name = "serde_attrs"

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#![forbid(unsafe_code)]
3939
#![deny(missing_docs)]
4040
#![recursion_limit = "1024"]
41+
// Enable feature requirements in the docs from 1.57
42+
// See https://stackoverflow.com/questions/61417452
43+
#![cfg_attr(docs_rs, feature(doc_auto_cfg))]
4144

4245
#[cfg(feature = "serialize")]
4346
pub mod de;

0 commit comments

Comments
 (0)