-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #84222 - Aaron1011:fix/anon-const-lint, r=lcnr
Run buffered lints attached to anon consts Fixes #84195
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Regression test for issue #84195 | ||
// Checks that we properly fire lints that occur inside | ||
// anon consts. | ||
|
||
#![deny(semicolon_in_expressions_from_macros)] | ||
|
||
macro_rules! len { | ||
() => { 0; }; //~ ERROR trailing semicolon | ||
//~| WARN this was previously accepted | ||
} | ||
|
||
fn main() { | ||
let val: [u8; len!()] = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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 | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/issue-84195-lint-anon-const.rs:5:9 | ||
| | ||
LL | #![deny(semicolon_in_expressions_from_macros)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= 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: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to previous error | ||
|