Skip to content

Commit 288a565

Browse files
committed
Upgrade semicolon_in_expressions_from_macros from warn to deny
This is already warn-by-default, and a future compatibility warning (FCW) that warns in dependencies. Upgrade it to deny-by-default, as the next step towards hard error.
1 parent 5a30e43 commit 288a565

10 files changed

+41
-44
lines changed

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,7 @@ declare_lint! {
28382838
/// [issue #79813]: https://github.com/rust-lang/rust/issues/79813
28392839
/// [future-incompatible]: ../index.md#future-incompatible-lints
28402840
pub SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
2841-
Warn,
2841+
Deny,
28422842
"trailing semicolon in macro body used as expression",
28432843
@future_incompatible = FutureIncompatibleInfo {
28442844
reason: FutureIncompatibilityReason::FutureReleaseError,

tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
//@ check-pass
2-
// Ensure that trailing semicolons cause warnings by default
1+
// Ensure that trailing semicolons cause errors by default
32

43
macro_rules! foo {
54
() => {
6-
true; //~ WARN trailing semicolon in macro
5+
true; //~ ERROR trailing semicolon in macro
76
//~| WARN this was previously
87
}
98
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
warning: trailing semicolon in macro used in expression position
2-
--> $DIR/warn-semicolon-in-expressions-from-macros.rs:6:13
1+
error: trailing semicolon in macro used in expression position
2+
--> $DIR/warn-semicolon-in-expressions-from-macros.rs:5:13
33
|
44
LL | true;
55
| ^
@@ -9,14 +9,14 @@ LL | _ => foo!()
99
|
1010
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1111
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
12-
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
13-
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
12+
= note: `#[deny(semicolon_in_expressions_from_macros)]` on by default
13+
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

15-
warning: 1 warning emitted
15+
error: aborting due to 1 previous error
1616

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

tests/ui/macros/lint-trailing-macro-call.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
//@ check-pass
2-
//
31
// Ensures that we properly lint
42
// a removed 'expression' resulting from a macro
53
// in trailing expression position
64

75
macro_rules! expand_it {
86
() => {
9-
#[cfg(false)] 25; //~ WARN trailing semicolon in macro
7+
#[cfg(false)] 25; //~ ERROR trailing semicolon in macro
108
//~| WARN this was previously
119
}
1210
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
warning: trailing semicolon in macro used in expression position
2-
--> $DIR/lint-trailing-macro-call.rs:9:25
1+
error: trailing semicolon in macro used in expression position
2+
--> $DIR/lint-trailing-macro-call.rs:7:25
33
|
44
LL | #[cfg(false)] 25;
55
| ^
@@ -11,14 +11,14 @@ LL | expand_it!()
1111
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
1212
= note: macro invocations at the end of a block are treated as expressions
1313
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it`
14-
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
15-
= note: this warning originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info)
14+
= note: `#[deny(semicolon_in_expressions_from_macros)]` on by default
15+
= note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

17-
warning: 1 warning emitted
17+
error: aborting due to 1 previous error
1818

1919
Future incompatibility report: Future breakage diagnostic:
20-
warning: trailing semicolon in macro used in expression position
21-
--> $DIR/lint-trailing-macro-call.rs:9:25
20+
error: trailing semicolon in macro used in expression position
21+
--> $DIR/lint-trailing-macro-call.rs:7:25
2222
|
2323
LL | #[cfg(false)] 25;
2424
| ^
@@ -30,6 +30,6 @@ LL | expand_it!()
3030
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
3131
= note: macro invocations at the end of a block are treated as expressions
3232
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it`
33-
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
34-
= note: this warning originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info)
33+
= note: `#[deny(semicolon_in_expressions_from_macros)]` on by default
34+
= note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info)
3535

tests/ui/macros/macro-context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ macro_rules! m {
66
//~| ERROR macro expansion ignores `;`
77
//~| ERROR cannot find type `i` in this scope
88
//~| ERROR cannot find value `i` in this scope
9-
//~| WARN trailing semicolon in macro
9+
//~| ERROR trailing semicolon in macro
1010
//~| WARN this was previously
1111
}
1212

tests/ui/macros/macro-context.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ LL | let i = m!();
6464
|
6565
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
6666

67-
warning: trailing semicolon in macro used in expression position
67+
error: trailing semicolon in macro used in expression position
6868
--> $DIR/macro-context.rs:3:15
6969
|
7070
LL | () => ( i ; typeof );
@@ -75,15 +75,15 @@ LL | let i = m!();
7575
|
7676
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7777
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
78-
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
79-
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
78+
= note: `#[deny(semicolon_in_expressions_from_macros)]` on by default
79+
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
8080

81-
error: aborting due to 6 previous errors; 1 warning emitted
81+
error: aborting due to 7 previous errors
8282

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

tests/ui/macros/macro-in-expression-context.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
macro_rules! foo {
44
() => {
55
assert_eq!("A", "A");
6-
//~^ WARN trailing semicolon in macro
6+
//~^ ERROR trailing semicolon in macro
77
//~| WARN this was previously
88
//~| NOTE macro invocations at the end of a block
99
//~| NOTE to ignore the value produced by the macro
1010
//~| NOTE for more information
11-
//~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default
11+
//~| NOTE `#[deny(semicolon_in_expressions_from_macros)]` on by default
1212
assert_eq!("B", "B");
1313
}
1414
//~^^ ERROR macro expansion ignores `assert_eq` and any tokens following

tests/ui/macros/macro-in-expression-context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
macro_rules! foo {
44
() => {
55
assert_eq!("A", "A");
6-
//~^ WARN trailing semicolon in macro
6+
//~^ ERROR trailing semicolon in macro
77
//~| WARN this was previously
88
//~| NOTE macro invocations at the end of a block
99
//~| NOTE to ignore the value produced by the macro
1010
//~| NOTE for more information
11-
//~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default
11+
//~| NOTE `#[deny(semicolon_in_expressions_from_macros)]` on by default
1212
assert_eq!("B", "B");
1313
}
1414
//~^^ ERROR macro expansion ignores `assert_eq` and any tokens following

tests/ui/macros/macro-in-expression-context.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ help: you might be missing a semicolon here
1313
LL | foo!();
1414
| +
1515

16-
warning: trailing semicolon in macro used in expression position
16+
error: trailing semicolon in macro used in expression position
1717
--> $DIR/macro-in-expression-context.rs:5:29
1818
|
1919
LL | assert_eq!("A", "A");
@@ -26,13 +26,13 @@ LL | foo!()
2626
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
2727
= note: macro invocations at the end of a block are treated as expressions
2828
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
29-
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
30-
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
29+
= note: `#[deny(semicolon_in_expressions_from_macros)]` on by default
30+
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
3131

32-
error: aborting due to 1 previous error; 1 warning emitted
32+
error: aborting due to 2 previous errors
3333

3434
Future incompatibility report: Future breakage diagnostic:
35-
warning: trailing semicolon in macro used in expression position
35+
error: trailing semicolon in macro used in expression position
3636
--> $DIR/macro-in-expression-context.rs:5:29
3737
|
3838
LL | assert_eq!("A", "A");
@@ -45,6 +45,6 @@ LL | foo!()
4545
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
4646
= note: macro invocations at the end of a block are treated as expressions
4747
= note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo`
48-
= note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
49-
= note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
48+
= note: `#[deny(semicolon_in_expressions_from_macros)]` on by default
49+
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
5050

0 commit comments

Comments
 (0)