Skip to content

Commit 1ab8ff5

Browse files
committed
Add test suggest-remove-semi-in-macro-expansion-issue-142143.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
1 parent 55d4364 commit 1ab8ff5

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Make sure we don't suggest remove redundant semicolon inside macro expansion.(issue #142143)
2+
3+
#![deny(redundant_semicolons)]
4+
5+
macro_rules! m {
6+
($stmt:stmt) => { #[allow(bad_style)] $stmt } //~ ERROR unnecessary trailing semicolon [redundant_semicolons]
7+
}
8+
9+
fn main() {
10+
m!(;);
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: unnecessary trailing semicolon
2+
--> $DIR/suggest-remove-semi-in-macro-expansion-issue-142143.rs:6:43
3+
|
4+
LL | ($stmt:stmt) => { #[allow(bad_style)] $stmt }
5+
| ^^^^^ help: remove this semicolon
6+
...
7+
LL | m!(;);
8+
| ----- in this macro invocation
9+
|
10+
note: the lint level is defined here
11+
--> $DIR/suggest-remove-semi-in-macro-expansion-issue-142143.rs:3:9
12+
|
13+
LL | #![deny(redundant_semicolons)]
14+
| ^^^^^^^^^^^^^^^^^^^^
15+
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
16+
17+
error: aborting due to 1 previous error
18+

0 commit comments

Comments
 (0)