rust/tests/ui/macros/macro-fragment-ident-underscore-error.rs
2025-07-10 18:47:20 +05:00

13 lines
318 B
Rust

//! 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 `_`
}