macro_rules matcher colon instead semicolon
Open
@ozankenangungor is already working on this.
Since Mar 3, 2026.
A-diagnostics
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
macro_rules! foo {
($x;tt) => {};
}
Current output
error: missing fragment specifier
--> src/bin/main.rs:2:6
|
2 | ($x;tt) => {};
| ^^
|
= note: fragment specifiers must be provided
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
help: try adding a specifier here
|
2 | ($x:spec;tt) => {};
| +++++
Desired output
error: missing fragment specifier
--> src/bin/main.rs:2:6
|
2 | ($x;tt) => {};
| ^^
|
= note: fragment specifiers must be provided
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
help: try adding a specifier here
|
2 | ($x:spec;tt) => {};
| +++++
help: use a semicolon instead
|
2 - ($x;tt) => {};
2 + ($x:tt) => {};
Rationale and extra context
No response
Other cases
Rust Version
rustc 1.95.0-nightly (a293cc4af 2026-01-30)
binary: rustc
commit-hash: a293cc4af8b26701c42738381c0c6f9d2ba881e0
commit-date: 2026-01-30
host: aarch64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.