META_VARIABLE_MISUSE in rustc_lint::builtin - Rust
Description: The `meta_variable_misuse` lint detects possible meta-variable misuse in macro definitions.

Skip to main content

## META_VARIABLE_MISUSE

# Static META_VARIABLE_MISUSE

Source

    pub static META_VARIABLE_MISUSE: &'static Lint

Expand description

The `meta_variable_misuse` lint detects possible meta-variable misuse in macro definitions.

#### §Example

ⓘ

    #![deny(meta_variable_misuse)]

    macro_rules! foo {
        () => {};
        ($( $i:ident = $($j:ident),+ );*) => { $( $( $i = $k; )+ )* };
    }

    fn main() {
        foo!();
    }

{{produces}}

#### §Explanation

There are quite a few different ways a `macro_rules` macro can be improperly defined. Many of these errors were previously only detected when the macro was expanded or not at all. This lint is an attempt to catch some of these problems when the macro is defined.

This lint is “allow” by default because it may have false positives and other issues. See issue #61053 for more details.