rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.2k stars 1.59k forks source link

The complete list of calls outside of macro_rules contains macro_rules local variables within macro_rules #16342

Open A4-Tacks opened 9 months ago

A4-Tacks commented 9 months ago
fn main() {
    macro_rules! foo {
        () => {
            let var = 2;
            dbg!(var);
        };
    }
    foo!();
    var;
}

cargo check

error[E0425]: cannot find value `var` in this scope
 --> src/main.rs:9:5
  |
9 |     var;
  |     ^^^ not found in this scope
  |

from line9 open complete list output

var i32                   [LS]
self::                    [LS]
crate::                   [LS]
foo!() macro_rules! foo   [LS]
main()~ fn()              [LS]
...

rust-analyzer version: rust-analyzer 1.74.0 (79e9716c 2023-11-13) and rust-analyzer 1.77.0-nightly (bf8716f1 2023-12-24)

rustc version: rustc 1.74.0 (79e9716c9 2023-11-13) and rustc 1.77.0-nightly (bf8716f1c 2023-12-24)

relevant settings: NONE

Veykril commented 9 months ago

Hygiene isn't yet implemented in rust-analyzer