Skip to content

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

Closed
@A4-Tacks

Description

@A4-Tacks
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions