Skip to content

Comments

docgen/website: show deprecated function warnings on docs website#584

Merged
cpu merged 12 commits intorustls:mainfrom
cpu:ci/cpu-deprecate-notes
Feb 23, 2026
Merged

docgen/website: show deprecated function warnings on docs website#584
cpu merged 12 commits intorustls:mainfrom
cpu:ci/cpu-deprecate-notes

Conversation

@cpu
Copy link
Member

@cpu cpu commented Jul 10, 2025

Updates the docgen tool from the tools crate to parse the DEPRECATED_FUNC macro invocations ahead of function declarations. Once parsed we can pull out the argument message and include that in the JSON data generated by the tool.

With the deprecated messages the website Zola templates can reference them to add a note of the deprecation in the TOC and to add a warning banner to the item's docs rendering.

Resolves #582

Examples:

toc deprecated banner

@cpu cpu self-assigned this Jul 10, 2025
@cpu
Copy link
Member Author

cpu commented Jul 10, 2025

While tidying things up I checked the diff of the generated JSON against the tip-of-main to make sure I didn't break anything that previously worked.

Maybe we should start checking in the data JSON and set up CI to verify that a fresh docgen tool run doesn't produce any diff with the branch content.

That way we could review the JSON diffs alongside code updates (both to the tool & the lib) to see if we accidentally lose items/comments/etc.

@cpu
Copy link
Member Author

cpu commented Jul 11, 2025

Thanks for the review 🌠 I'll iterate this weekend.

@cpu cpu force-pushed the ci/cpu-deprecate-notes branch from 746a69e to 968640d Compare July 13, 2025 17:14
Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for all the nitty feedback...

@cpu cpu marked this pull request as draft July 28, 2025 14:20
@cpu
Copy link
Member Author

cpu commented Jul 28, 2025

cpu marked this pull request as draft

Will try to return to this soon. The weather has been too nice to spend weekends indoors 😆

@cpu cpu force-pushed the ci/cpu-deprecate-notes branch from 968640d to f349f0d Compare September 28, 2025 17:11
@cpu cpu marked this pull request as ready for review September 28, 2025 17:12
@cpu cpu force-pushed the ci/cpu-deprecate-notes branch from f349f0d to 87643b4 Compare October 21, 2025 20:58
cpu added 12 commits February 22, 2026 14:57
This way we can review updates to the website documentation data
alongside code changes.

```
$ cargo run --manifest-path tools/Cargo.toml --bin docgen > ./website/static/api.json
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
     Running `target/debug/docgen`
```
Now that we're checking in the `api.json` content generated by the
`docgen` tool the expectation is that there shouldn't be any uncommitted
diffs when running the tool fresh in CI.
But update the package/upload and deploy steps to only happen for
rustls-ffi's main branch.
Also rename some bindings for clarity. The input node is the previous
sibling node for a to-be-documented item so call it `prev`. We also look
at `prev`'s previous sibling node, so call those instances `prev_prev`.
We also only care about named (not anonymous) sibling nodes, so use
just `prev_named_sibling()` instead of the mix of `prev_sibling()` and
`prev_named_sibling()`.
Handle the simple case up-front.
We can handle the case where prev is an expression_statement by
recursing with `prev_prev`.
The `api.json` data is updated to add the newly parsed deprecation
messages.
@cpu cpu force-pushed the ci/cpu-deprecate-notes branch from 87643b4 to 4f1a848 Compare February 22, 2026 20:22
@cpu
Copy link
Member Author

cpu commented Feb 22, 2026

@djc I think this is hopefully ready for one final review. Sorry it's been a slog.

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed this, LGTM! Thanks for the iterations...

@cpu cpu merged commit 3596689 into rustls:main Feb 23, 2026
46 checks passed
@cpu cpu deleted the ci/cpu-deprecate-notes branch February 23, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show deprecation messages in generated docs

2 participants