about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.rs11
-rw-r--r--tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr18
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.rs b/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.rs
new file mode 100644
index 00000000000..4360eb964a4
--- /dev/null
+++ b/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.rs
@@ -0,0 +1,11 @@
+// Make sure we don't suggest remove redundant semicolon inside macro expansion.(issue #142143)
+
+#![deny(redundant_semicolons)]
+
+macro_rules! m {
+    ($stmt:stmt) => { #[allow(bad_style)] $stmt } //~ ERROR unnecessary trailing semicolon [redundant_semicolons]
+}
+
+fn main() {
+    m!(;);
+}
diff --git a/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr b/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr
new file mode 100644
index 00000000000..909c9f84d0b
--- /dev/null
+++ b/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr
@@ -0,0 +1,18 @@
+error: unnecessary trailing semicolon
+  --> $DIR/suggest-remove-semi-in-macro-expansion-issue-142143.rs:6:43
+   |
+LL |     ($stmt:stmt) => { #[allow(bad_style)] $stmt }
+   |                                           ^^^^^ help: remove this semicolon
+...
+LL |     m!(;);
+   |     ----- in this macro invocation
+   |
+note: the lint level is defined here
+  --> $DIR/suggest-remove-semi-in-macro-expansion-issue-142143.rs:3:9
+   |
+LL | #![deny(redundant_semicolons)]
+   |         ^^^^^^^^^^^^^^^^^^^^
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 1 previous error
+