macro_legacy_warnings -> error

This commit is contained in:
Mazdak Farrokhzad 2019-12-03 18:47:44 +01:00
parent 2e6eaceede
commit cec2a9fad0
7 changed files with 35 additions and 97 deletions

View file

@ -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); }

View file

@ -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)

View 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); }

View 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