about summary refs log tree commit diff
path: root/tests/ui/macros/macro-fragment-ident-underscore-error.rs
blob: 882dd167adc7d691ae45045938fba069460b1dce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
//! Verifies that the reserved underscore `_` cannot be used as an `ident` fragment specifier
//! within a macro pattern, as it leads to a compilation error.

macro_rules! identity {
    ($i: ident) => {
        $i
    };
}

fn main() {
    let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_`
}