Skip to content

Commit b852142

Browse files
committed
Generate macro expansion in rustdoc
A recent rust nightly added the ability to show macro expansions in the rustdoc output. Since this crate uses macros for many trait implementations, this is useful for users trying to understand the macro output. rust-lang/rust#137229
1 parent f414463 commit b852142

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

serde_with/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
* Show macro expansion in the docs.rs generated rustdoc.
13+
Since macros are used to generate trait implementations, this is useful to understand the exact generated code.
14+
1015
## [3.14.0] - 2025-06-30
1116

1217
### Added

serde_with/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,13 @@ all-features = true
266266
rustdoc-args = [
267267
# Enable doc_cfg showing the required features.
268268
"--cfg=docsrs",
269+
"-Zunstable-options",
269270
# Generate links to definition in rustdoc source code pages
270271
# https://github.com/rust-lang/rust/pull/84176
271-
"-Zunstable-options",
272272
"--generate-link-to-definition",
273+
# Generate buttons to show macro expansions in the rustdoc output.
274+
# https://github.com/rust-lang/rust/pull/137229
275+
"--generate-macro-expansion",
273276
# Link to the stable documentation for core/alloc/std/proc_macro even though docs.rs uses nightly.
274277
# https://github.com/rust-lang/docs.rs/issues/506#issuecomment-2670501688
275278
"--extern-html-root-url=core=https://doc.rust-lang.org",

serde_with_macros/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
* Show macro expansion in the docs.rs generated rustdoc.
13+
Since macros are used to generate trait implementations, this is useful to understand the exact generated code.
14+
1015
## [3.14.0] - 2025-06-30
1116

1217
### Added

serde_with_macros/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ version-sync = "0.9.1"
6161

6262
[package.metadata.docs.rs]
6363
all-features = true
64+
rustdoc-args = [
65+
# Enable doc_cfg showing the required features.
66+
"--cfg=docsrs",
67+
"-Zunstable-options",
68+
# Generate links to definition in rustdoc source code pages
69+
# https://github.com/rust-lang/rust/pull/84176
70+
"--generate-link-to-definition",
71+
# Generate buttons to show macro expansions in the rustdoc output.
72+
# https://github.com/rust-lang/rust/pull/137229
73+
"--generate-macro-expansion",
74+
# Link to the stable documentation for core/alloc/std/proc_macro even though docs.rs uses nightly.
75+
# https://github.com/rust-lang/docs.rs/issues/506#issuecomment-2670501688
76+
"--extern-html-root-url=core=https://doc.rust-lang.org",
77+
"--extern-html-root-url=alloc=https://doc.rust-lang.org",
78+
"--extern-html-root-url=std=https://doc.rust-lang.org",
79+
"--extern-html-root-url=proc_macro=https://doc.rust-lang.org",
80+
]
6481

6582
[package.metadata.release]
6683
pre-release-replacements = [

0 commit comments

Comments
 (0)