Macro hygene not implemented
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 230
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
I tried this code:
macro_rules! decl {
() => {let a = 12;}
}
pub fn foo() -> i32 {
decl!();
a
}
I expected to see this happen:
error[E0425]: cannot find value `a` in this scope
--> src/lib.rs:7:5
|
7 | a
| ^ not found in this scope
Instead, this happened: no error
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.
Research direction
Start by compiling the Rust macro_rules! reproducer from the issue and compare its result with the expected E0425 diagnostic. Trace the compiler's macro expansion and name-resolution handling for the local a; done means the example reports that a is not found in scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100