Skip to content

[Change]: [1.99.0] Stabilize '#[my_macro] mod foo;' - #729

Open
PLeVasseur wants to merge 1 commit into
rust-lang:mainfrom
PLeVasseur:outline-modules-in-proc-macros
Open

PLeVasseur wants to merge 1 commit into
rust-lang:mainfrom
PLeVasseur:outline-modules-in-proc-macros

Conversation

@PLeVasseur

Copy link
Copy Markdown
Contributor

Summary

Document how attribute and derive macros receive outline module declarations without loading the module files.

Refs #726

Reference alignment

Rust #157857 and Reference #2310. Derive coverage also follows the stabilization tests.

Rust 1.99 stabilizes outline modules (`mod foo;`) in the input of
attribute and derive procedural macros (rust-lang/rust#157857). The
macro receives the module declaration as tokens; the module's source
file is not loaded and its contents are not part of the input.
@PLeVasseur

Copy link
Copy Markdown
Contributor Author

@tshepang -- would you also like to take a look, before this merges?

Comment thread src/macros.rst
:s:`StructDeclaration`, or :s:`UnionDeclaration`.

:dp:`fls_TFDKS0Nl3Rwh`
The :t:`token` stream captured by the sole :t:`function parameter` of the :t:`macro implementation function` of a :t:`derive macro` excludes the contents of the :t:`source file` of any :t:`outline module`. The :t:`[source file]s` of such :t:`[outline module]s` are not loaded to produce this :t:`token` stream.

@tshepang tshepang Sep 29, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • that it is the sole function parameter is stated in a preceding rule
  • specify that the outline module is part of the macro input (but am not sure if it is clear enough)
  • second sentence feels redundant
Suggested change
The :t:`token` stream captured by the sole :t:`function parameter` of the :t:`macro implementation function` of a :t:`derive macro` excludes the contents of the :t:`source file` of any :t:`outline module`. The :t:`[source file]s` of such :t:`[outline module]s` are not loaded to produce this :t:`token` stream.
The :t:`token` stream captured by the :t:`function parameter` of the :t:`macro implementation function` of a :t:`derive macro` excludes the contents of the :t:`source file` of any :t:`outline module` in the input.

View changes since the review

Comment thread src/macros.rst
all :t:`[outer attribute]s` that apply to that :t:`item`.

:dp:`fls_yJma4E9orknX`
The :t:`token` stream captured by the second :t:`function parameter` of the :t:`macro implementation function` of an :t:`attribute macro` excludes the contents of the :t:`source file` of any :t:`outline module`. The :t:`[source file]s` of such :t:`[outline module]s` are not loaded to produce this :t:`token` stream.

@tshepang tshepang Sep 29, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • added "input" for clarification
  • second sentence feels redundant
Suggested change
The :t:`token` stream captured by the second :t:`function parameter` of the :t:`macro implementation function` of an :t:`attribute macro` excludes the contents of the :t:`source file` of any :t:`outline module`. The :t:`[source file]s` of such :t:`[outline module]s` are not loaded to produce this :t:`token` stream.
The :t:`token` stream captured by the second :t:`function parameter` of the :t:`macro implementation function` of an :t:`attribute macro` excludes the contents of the :t:`source file` of any :t:`outline module` in the input.

View changes since the review

This branch has not been deployed

No deployments
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.

3 participants