mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
parent
8aa11816f3
commit
19c9d93ab5
@ -109,6 +109,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
|
|||||||
|
|
||||||
fn visit_anon_const(&mut self, c: &'a ast::AnonConst) {
|
fn visit_anon_const(&mut self, c: &'a ast::AnonConst) {
|
||||||
run_early_pass!(self, check_anon_const, c);
|
run_early_pass!(self, check_anon_const, c);
|
||||||
|
self.check_id(c.id);
|
||||||
ast_visit::walk_anon_const(self, c);
|
ast_visit::walk_anon_const(self, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
src/test/ui/macros/issue-84195-lint-anon-const.rs
Normal file
14
src/test/ui/macros/issue-84195-lint-anon-const.rs
Normal file
@ -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!()] = [];
|
||||||
|
}
|
20
src/test/ui/macros/issue-84195-lint-anon-const.stderr
Normal file
20
src/test/ui/macros/issue-84195-lint-anon-const.stderr
Normal file
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user