Skip to content

Document procedural macros in expression position - #2374

Open
Huzaifa-Asif wants to merge 1 commit into
rust-lang:masterfrom
Huzaifa-Asif:docs/proc-macro-expression-example
Open

Huzaifa-Asif wants to merge 1 commit into
rust-lang:masterfrom
Huzaifa-Asif:docs/proc-macro-expression-example

Conversation

@Huzaifa-Asif

@Huzaifa-Asif Huzaifa-Asif commented Oct 4, 2026 •

Copy link
Copy Markdown

Summary

  • extend the function-like procedural macro example with a macro that expands to the expression 42
  • invoke that macro directly in expression position alongside the existing item-position example

This fills the documentation gap described in #858 without changing the surrounding normative text.

Closes #858.

Verification

  • git diff --check — passed locally
  • GitHub CI — code tests, style tests, mdbook-spec, tools, preview, dev-guide build, zizmor, and success gate all passed
  • Local cargo xtask style-check could not start because interrupted rustup downloads left the local nightly and stable installations with missing manifests

AI assistance disclosure

OpenAI Codex assisted with issue research, the documentation edit, verification, and drafting this description.

@Huzaifa-Asif
Huzaifa-Asif marked this pull request as ready for review October 4, 2026 15:46
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Oct 4, 2026

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

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an example of using a function-like proc macro in expression position

2 participants