Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

"Macros by example" page mixes language and macro_rules input syntax definitions

Open
#2,267 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust

Research direction

Start with the Macros by example page and compare its MacroRules syntax section with the distinction described in the issue. Separate the language syntax from the syntax accepted inside macro_rules! while preserving the existing content, and verify that the reference no longer implies the demonstrated valid Rust is syntactically invalid.

Written by the indexing model from the issue text.

Description

My understanding is the reference's syntax sections should represent what is syntactically valid Rust. However, given the current syntax on the Macros by example page it implies the following code is syntactically invalid.

#[cfg(false)]
macro_rules! name {
  struct Demo;
}

This in fact compiles fine. The macro_rules! acts as a normal macro call where the body is allowed to be any token stream. This means in the reference the MacroRules should actually be Token*.

I propose the reference be changed so that this page splits the syntax for the language vs the syntax inside macro_rules! calls. This way no content is lost, but the distinction is shown.

Dominant language
Rust
Stars
1.6k
Forks
609
Avg merge
1d 4h
Merged PRs (30d)
7

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/reference

All issues in rust-lang/reference

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.