rust-lang / rust-lang/rust-analyzer
Comparator ops inside macros inside macros don't expand properly.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.2803-standalone (0c746f6990 2026-02-22) [c:\Users\[Expunged]\.vscode\extensions\rust-lang.rust-analyzer-0.3.2803-win32-x64\server\rust-analyzer.exe] and rust-analyzer version: 0.3.2819-standalone (51966da92d 2026-03-08) [c:\Users\[Expunged]\.vscode\extensions\rust-lang.rust-analyzer-0.3.2819-win32-x64\server\rust-analyzer.exe]
rustc version: Tested on 1.93.0, 1.93.1, 1.94
editor or extension: Visual Studio Code. Extension versions:
0.3.2803 & 0.3.2819
(also tested on the pre-release version of 0.3.2803 and probably whatever version came right before that because it updated while I was making the reproducible example)
relevant settings: All settings set to default except cargo check which was tested on both clippy and check (most likely irrelevant but is true).
code snippet to reproduce:
macro_rules! def_macro {
() => {
macro_rules! bar {
($x:ident, $y:ident) => {
let _ = $x == $y;
let _ = $x <= $y;
let _ = $x >= $y;
}
}
pub fn foo(x: u32, y: u32) {
bar!(x, y);
}
};
}
def_macro!();
// result of expansion:
// macro_rules! bar {
// ($x:ident, $y:ident) => {
// let _ = $x = = $y;
// let _ = $x< = $y;
// let _ = $x> = $y;
// }
// }
// pub fn foo(x:u32,y:u32){
// bar!(x,y);
// }
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 reproducing the nested macro example in rust-analyzer and inspect the macro-expansion path responsible for comparator tokens. Done means the inner macro preserves ==, <=, and >= correctly after both levels expand, with a regression check covering the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100