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() {
|
2024-06-25 12:52:15 +10:00
|
|
|
let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_`
|
2018-03-17 22:08:18 +03:00
|
|
|
}
|