Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS to future-incompat report #103418

Merged
merged 1 commit into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2948,6 +2948,7 @@ declare_lint! {
"trailing semicolon in macro body used as expression",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,140 @@ LL | let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_

warning: 3 warnings emitted

Future incompatibility report: Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:9:13
|
LL | true;
| ^
...
LL | foo!(first)
| ----------- in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
= note: macro invocations at the end of a block are treated as expressions
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
note: the lint level is defined here
--> $DIR/semicolon-in-expressions-from-macros.rs:24:13
|
LL | #[allow(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:9:13
|
LL | true;
| ^
...
LL | let _ = foo!(second);
| ------------ in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
note: the lint level is defined here
--> $DIR/semicolon-in-expressions-from-macros.rs:29:13
|
LL | #[allow(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:9:13
|
LL | true;
| ^
...
LL | let _ = foo!(third);
| ----------- in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
note: the lint level is defined here
--> $DIR/semicolon-in-expressions-from-macros.rs:32:13
|
LL | #[allow(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:9:13
|
LL | true;
| ^
...
LL | let _ = foo!(fourth);
| ------------ in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
note: the lint level is defined here
--> $DIR/semicolon-in-expressions-from-macros.rs:37:13
|
LL | #[allow(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:9:13
|
LL | true;
| ^
...
LL | foo!(warn_in_block)
| ------------------- in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
= note: macro invocations at the end of a block are treated as expressions
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
note: the lint level is defined here
--> $DIR/semicolon-in-expressions-from-macros.rs:4:9
|
LL | #![warn(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:9:13
|
LL | true;
| ^
...
LL | let _ = foo!(warn_in_expr);
| ------------------ in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
note: the lint level is defined here
--> $DIR/semicolon-in-expressions-from-macros.rs:4:9
|
LL | #![warn(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/semicolon-in-expressions-from-macros.rs:9:13
|
LL | true;
| ^
...
LL | let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
| ------------------------- in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
note: the lint level is defined here
--> $DIR/semicolon-in-expressions-from-macros.rs:4:9
|
LL | #![warn(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,18 @@ LL | _ => foo!()

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/warn-semicolon-in-expressions-from-macros.rs:6:13
|
LL | true;
| ^
...
LL | _ => foo!()
| ------ in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

19 changes: 19 additions & 0 deletions tests/ui/macros/issue-84195-lint-anon-const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ LL | #![deny(semicolon_in_expressions_from_macros)]

error: aborting due to previous error

Future incompatibility report: Future breakage diagnostic:
error: trailing semicolon in macro used in expression position
--> $DIR/issue-84195-lint-anon-const.rs:8:14
|
LL | () => { 0; };
| ^
...
LL | let val: [u8; len!()] = [];
| ------ in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
note: the lint level is defined here
--> $DIR/issue-84195-lint-anon-const.rs:5:9
|
LL | #![deny(semicolon_in_expressions_from_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info)

17 changes: 17 additions & 0 deletions tests/ui/macros/lint-trailing-macro-call.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ LL | expand_it!()

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/lint-trailing-macro-call.rs:9:25
|
LL | #[cfg(FALSE)] 25;
| ^
...
LL | expand_it!()
| ------------ in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
= note: macro invocations at the end of a block are treated as expressions
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it`
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
= note: this warning originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info)

15 changes: 15 additions & 0 deletions tests/ui/macros/macro-context.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,18 @@ error: aborting due to 6 previous errors; 1 warning emitted

Some errors have detailed explanations: E0412, E0425.
For more information about an error, try `rustc --explain E0412`.
Future incompatibility report: Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/macro-context.rs:3:15
|
LL | () => ( i ; typeof );
| ^
...
LL | let i = m!();
| ---- in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)

17 changes: 17 additions & 0 deletions tests/ui/macros/macro-in-expression-context.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,20 @@ LL | foo!()

error: aborting due to previous error; 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/macro-in-expression-context.rs:5:29
|
LL | assert_eq!("A", "A");
| ^
...
LL | foo!()
| ------ in this macro invocation
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
= note: macro invocations at the end of a block are treated as expressions
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)