Skip to content

Conversation

ophilli
Copy link

@ophilli ophilli commented Oct 2, 2025

Problem: state_machine!() users could not document their state and superstate handler functions with doc comments that would appear on the generated enum variants. This made the generated code harder to understand, reduced IDE support, and meant users could not use lints like missing_docs.

Solution: Propagate doc comments through the macro pipeline by extracting them from the state/superstate handler functions during analysis, and then attaching the extracted doc comments as attributes to the generated enum variants. Additionally we added default doc comments to the generated State and Superstate enums.

Testing: Added trybuild tests that use #![deny(missing_docs)] to validate that the doc comments are propagated.

Problem: `state_machine!()` users could not document their state and
superstate handler functions with doc comments that would appear on
the generated enum variants. This made the generated code harder to
understand, reduced IDE support, and meant users could not use lints
like `missing_docs`.

Solution: Propagate doc comments through the macro pipeline by
extracting them from the state/superstate handler functions during
analysis, and then attaching the extracted doc comments as attributes
to the generated enum variants. Additionally we added default doc
comments to the generated State and Superstate enums.

Testing: Added trybuild tests that use `#![deny(missing_docs)]` to
validate that the doc comments are propagated.
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.

2 participants