Static rustc_ap_rustc_lint_defs::builtin::META_VARIABLE_MISUSE[][src]

pub static META_VARIABLE_MISUSE: &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.