Skip to content

Commit 0885f66

Browse files
committed
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.
1 parent ca77504 commit 0885f66

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

tests/ui/infinite/issue-41731-infinite-macro-print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
fn main() {
66
macro_rules! stack {
77
($overflow:expr) => {
8-
print!(stack!($overflow));
8+
print!(stack!($overflow))
99
//~^ ERROR recursion limit reached while expanding
1010
//~| ERROR format argument must be a string literal
1111
};

tests/ui/infinite/issue-41731-infinite-macro-print.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ LL | stack!("overflow");
1414
| ^^^^^^^^^^^^^^^^^^
1515
|
1616
= note: expanding `stack! { "overflow" }`
17-
= note: to `print! (stack! ("overflow"));`
17+
= note: to `print! (stack! ("overflow"))`
1818
= note: expanding `print! { stack! ("overflow") }`
1919
= note: to `{ $crate :: io :: _print($crate :: format_args! (stack! ("overflow"))); }`
2020
= note: expanding `stack! { "overflow" }`
21-
= note: to `print! (stack! ("overflow"));`
21+
= note: to `print! (stack! ("overflow"))`
2222
= note: expanding `print! { stack! ("overflow") }`
2323
= note: to `{ $crate :: io :: _print($crate :: format_args! (stack! ("overflow"))); }`
2424

@@ -31,7 +31,7 @@ LL | stack!("overflow");
3131
= note: this error originates in the macro `print` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info)
3232
help: you might be missing a string literal to format with
3333
|
34-
LL | print!("{}", stack!($overflow));
34+
LL | print!("{}", stack!($overflow))
3535
| +++++
3636

3737
error: aborting due to 2 previous errors

tests/ui/infinite/issue-41731-infinite-macro-println.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
fn main() {
66
macro_rules! stack {
77
($overflow:expr) => {
8-
println!(stack!($overflow));
8+
println!(stack!($overflow))
99
//~^ ERROR recursion limit reached while expanding
1010
//~| ERROR format argument must be a string literal
1111
};

tests/ui/infinite/issue-41731-infinite-macro-println.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ LL | stack!("overflow");
1414
| ^^^^^^^^^^^^^^^^^^
1515
|
1616
= note: expanding `stack! { "overflow" }`
17-
= note: to `println! (stack! ("overflow"));`
17+
= note: to `println! (stack! ("overflow"))`
1818
= note: expanding `println! { stack! ("overflow") }`
1919
= note: to `{ $crate :: io :: _print($crate :: format_args_nl! (stack! ("overflow"))); }`
2020
= note: expanding `stack! { "overflow" }`
21-
= note: to `println! (stack! ("overflow"));`
21+
= note: to `println! (stack! ("overflow"))`
2222
= note: expanding `println! { stack! ("overflow") }`
2323
= note: to `{ $crate :: io :: _print($crate :: format_args_nl! (stack! ("overflow"))); }`
2424

@@ -31,7 +31,7 @@ LL | stack!("overflow");
3131
= note: this error originates in the macro `println` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info)
3232
help: you might be missing a string literal to format with
3333
|
34-
LL | println!("{}", stack!($overflow));
34+
LL | println!("{}", stack!($overflow))
3535
| +++++
3636

3737
error: aborting due to 2 previous errors

0 commit comments

Comments
 (0)