rust/tests/ui/infinite/issue-41731-infinite-macro-println.rs
Josh Triplett 0885f660a5 Fix macro infinite recursion test to not trigger warning about semicolon in expr
The test cases for issue 41731 are about infinite macro recursion that
incorporates `print!` and `println!`. However, they also included
trailing semicolons despite expanding to expressions; that isn't what
these particular test cases are designed to test.

Eliminate the trailing semicolons, to simplify future work on removing
this special case. Every *other* macro that expands to a semicolon in an
expression is a test case for that specifically.
2025-08-10 14:08:18 -07:00

16 lines
341 B
Rust

//@ compile-flags: -Z trace-macros
#![recursion_limit = "5"]
fn main() {
macro_rules! stack {
($overflow:expr) => {
println!(stack!($overflow))
//~^ ERROR recursion limit reached while expanding
//~| ERROR format argument must be a string literal
};
}
stack!("overflow");
}