Files
rust/tests/ui/macros/macro-fragment-ident-underscore-error.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
318 B
Rust
Raw Normal View History

2025-07-01 21:46:28 +05:00
//! Verifies that the reserved underscore `_` cannot be used as an `ident` fragment specifier
//! within a macro pattern, as it leads to a compilation error.
2018-03-17 22:08:18 +03:00
macro_rules! identity {
2025-07-01 21:46:28 +05:00
($i: ident) => {
2018-03-17 22:08:18 +03:00
$i
2025-07-01 21:46:28 +05:00
};
2018-03-17 22:08:18 +03:00
}
fn main() {
let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_`
2018-03-17 22:08:18 +03:00
}