Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyo3-macros-backend: support macros inside doc attributes #1746

Merged
merged 1 commit into from
Aug 29, 2021

Conversation

davidhewitt
Copy link
Member

@davidhewitt davidhewitt commented Jul 30, 2021

WIP. (Needs tests, CHANGELOG entry.)

In Rust 1.54 it's now valid to write

#![doc = include_str!("README.md")]
struct Foo {}

This PR attempts to support these macros-inside-docs for pyclass and the other PyO3 macros. It works by collecting all the #[doc] attributes into one big concat! macro invocation, forwarding all the inner macros through so that concat! can evaluate them all and create the final docstring.

@davidhewitt davidhewitt force-pushed the doc-attributes-1.54 branch 7 times, most recently from 6992060 to 9f95ced Compare August 22, 2021 06:39
@davidhewitt davidhewitt changed the title pyo3-macros-backend: support macros inside doc macros pyo3-macros-backend: support macros inside doc attributes Aug 22, 2021
@davidhewitt
Copy link
Member Author

I think this is now ready for review if anyone's willing to take a look at it!

@davidhewitt
Copy link
Member Author

(I'll merge this at the weekend if I don't get any comments by then!)

@davidhewitt davidhewitt merged commit 3219c89 into PyO3:main Aug 29, 2021
@davidhewitt davidhewitt deleted the doc-attributes-1.54 branch August 29, 2021 06:12
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.

1 participant