rust-lang / rust-lang/rust-analyzer

macros 2.0 hygiene is not implemented

Open
#21,800 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-macro B-unstable C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer version: 0.4.2822-standalone (e0269ce3f2 2026-03-10)

rustc version: rustc 1.96.0-nightly (e370b60cf 2026-03-07)

editor or extension: VS Code 1.112.0; rust-analyzer extension 0.4.2822;

relevant settings: N/A

code snippet to reproduce:
crate a, src/lib.rs:

#![feature(decl_macro)]

pub macro inner() {
    true
}

pub macro outer() {{
    fn __check() -> bool {
        inner!()
    }
    true
}}

crate b, src/main.rs:

use a::outer;

fn main() {
    outer!();
}

Expected: No error. cargo +nightly build compiles.
Actual behavior:

expected bool, found ()

Image

Contributor guide

Open the contributing guide

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.

Research direction

Reproduce the issue with crate a/src/lib.rs and crate b/src/main.rs using the shown macro definitions, then run cargo +nightly build for comparison. Trace rust-analyzer's handling of the macro expansion and hygiene; done means the editor reports no type error, matching the successful cargo build.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.