Skip to content

Skip doc attributes that are not doc comments - #69

Merged
Manishearth merged 2 commits into
yaahc:masterfrom
bercedev:fix/doc-alias
Oct 21, 2026
Merged

Manishearth merged 2 commits into
yaahc:masterfrom
bercedev:fix/doc-alias

Conversation

@bercedev

Copy link
Copy Markdown
Contributor

Fixes #68

Display derive collected every #[doc ...] attribute and expected each one to be #[doc = "..."]. Anything else hit _ => unimplemented!(), so a #[doc(alias = "Baz")] (or #[doc(hidden)], #[doc(cfg(...))]) next to a doc comment made the derive panic with not implemented, as in the issue.

The doc attributes now go through filter_map, which keeps the string literals and skips the other forms. The text still comes only from the doc comments, so the variant in the issue displays as Station Mode.

tests/happy.rs gets the enum from the issue (/// Station Mode + #[doc(alias = "Baz")]) and checks DocAlias::Bar displays as Station Mode. On master that test file doesn't compile (proc-macro derive panicked, message: not implemented). cargo test passes on Rust 1.99.1, cargo fmt --check is clean, and there's a line under Unreleased > Changed in the changelog.

Note: I used Claude Code while working on this.

A #[doc(alias = "...")] next to a doc comment made the derive panic with "not implemented", because every doc attribute was expected to be #[doc = "..."]. Fixes #68.
@Manishearth

Copy link
Copy Markdown
Collaborator

CI failures need #70

@Manishearth
Manishearth merged commit 8ab7793 into yaahc:master Oct 21, 2026
8 checks passed
@Manishearth

Copy link
Copy Markdown
Collaborator

Thanks!

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.

proc-macro panics when using an doc alias

3 participants