diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-06-17 23:19:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-17 23:19:39 +0200 |
| commit | f663823fd5ff6db9a9d189a12d271960c79f3c8d (patch) | |
| tree | 9b6907f02d303b912e614c4bf7782af29e7793e3 /tests | |
| parent | 6148ec97720409b78609444bd5f45c7a771fb312 (diff) | |
| parent | 72fbf3ea6163d739dfa6c15312e3a7433b1fcb67 (diff) | |
| download | rust-f663823fd5ff6db9a9d189a12d271960c79f3c8d.tar.gz rust-f663823fd5ff6db9a9d189a12d271960c79f3c8d.zip | |
Rollup merge of #142631 - xizheyin:142143, r=Urgau
Dont suggest remove semi inside macro expansion for redundant semi lint Fixes rust-lang/rust#142143 r? compiler
Diffstat (limited to 'tests')
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..7a38ec318ab --- /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 } + | ^^^^^ +... +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 + |
