rust/tests/ui/macros/macro-context.rs
Josh Triplett 288a565451 Upgrade semicolon_in_expressions_from_macros from warn to deny
This is already warn-by-default, and a future compatibility warning
(FCW) that warns in dependencies. Upgrade it to deny-by-default, as the
next step towards hard error.
2025-07-23 09:14:12 -07:00

22 lines
794 B
Rust

// (typeof used because it's surprisingly hard to find an unparsed token after a stmt)
macro_rules! m {
() => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof`
//~| ERROR macro expansion ignores reserved keyword `typeof`
//~| ERROR macro expansion ignores `;`
//~| ERROR macro expansion ignores `;`
//~| ERROR cannot find type `i` in this scope
//~| ERROR cannot find value `i` in this scope
//~| ERROR trailing semicolon in macro
//~| WARN this was previously
}
fn main() {
let a: m!();
let i = m!();
match 0 {
m!() => {}
}
m!();
}