macro_legacy_warnings -> error
This commit is contained in:
parent
2e6eaceede
commit
cec2a9fad0
7 changed files with 35 additions and 97 deletions
|
|
@ -1,12 +0,0 @@
|
|||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
#![allow(unused)]
|
||||
|
||||
macro_rules! m {
|
||||
($($e1:expr),*; $($e2:expr),*) => {
|
||||
$( let x = $e1 )*; //~ WARN expected `;`
|
||||
$( println!("{}", $e2) )*; //~ WARN expected `;`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() { m!(0, 0; 0, 0); }
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
warning: expected `;`, found keyword `let`
|
||||
--> $DIR/missing-semicolon-warning.rs:6:12
|
||||
|
|
||||
LL | $( let x = $e1 )*;
|
||||
| ^^^
|
||||
...
|
||||
LL | fn main() { m!(0, 0; 0, 0); }
|
||||
| --------------- in this macro invocation
|
||||
|
|
||||
= note: this was erroneously allowed and will become a hard error in a future release
|
||||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
warning: expected `;`, found `println`
|
||||
--> $DIR/missing-semicolon-warning.rs:7:12
|
||||
|
|
||||
LL | $( println!("{}", $e2) )*;
|
||||
| ^^^^^^^
|
||||
...
|
||||
LL | fn main() { m!(0, 0; 0, 0); }
|
||||
| --------------- in this macro invocation
|
||||
|
|
||||
= note: this was erroneously allowed and will become a hard error in a future release
|
||||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
8
src/test/ui/parser/missing-semicolon.rs
Normal file
8
src/test/ui/parser/missing-semicolon.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
macro_rules! m {
|
||||
($($e1:expr),*; $($e2:expr),*) => {
|
||||
$( let x = $e1 )*; //~ ERROR expected one of `.`, `;`, `?`, or
|
||||
$( println!("{}", $e2) )*;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { m!(0, 0; 0, 0); }
|
||||
13
src/test/ui/parser/missing-semicolon.stderr
Normal file
13
src/test/ui/parser/missing-semicolon.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error: expected one of `.`, `;`, `?`, or an operator, found keyword `let`
|
||||
--> $DIR/missing-semicolon.rs:3:12
|
||||
|
|
||||
LL | $( let x = $e1 )*;
|
||||
| ^^^ expected one of `.`, `;`, `?`, or an operator
|
||||
...
|
||||
LL | fn main() { m!(0, 0; 0, 0); }
|
||||
| --------------- in this macro invocation
|
||||
|
|
||||
= 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…
Add table
Add a link
Reference in a new issue