2020-12-07 17:55:00 -06:00
|
|
|
// check-pass
|
2021-01-29 18:03:20 -06:00
|
|
|
// edition:2018
|
2021-07-14 18:24:12 -05:00
|
|
|
#![feature(stmt_expr_attributes)]
|
2020-12-07 17:55:00 -06:00
|
|
|
#![warn(semicolon_in_expressions_from_macros)]
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
macro_rules! foo {
|
|
|
|
($val:ident) => {
|
2021-07-14 18:24:12 -05:00
|
|
|
true; //~ WARN trailing semicolon in macro
|
|
|
|
//~| WARN this was previously accepted
|
|
|
|
//~| WARN trailing semicolon in macro
|
|
|
|
//~| WARN this was previously accepted
|
|
|
|
//~| WARN trailing semicolon in macro
|
|
|
|
//~| WARN this was previously accepted
|
2020-12-07 17:55:00 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-29 18:03:20 -06:00
|
|
|
#[allow(semicolon_in_expressions_from_macros)]
|
|
|
|
async fn bar() {
|
|
|
|
foo!(first);
|
|
|
|
}
|
|
|
|
|
2020-12-07 17:55:00 -06:00
|
|
|
fn main() {
|
|
|
|
#[allow(semicolon_in_expressions_from_macros)]
|
|
|
|
let _ = {
|
|
|
|
foo!(first)
|
|
|
|
};
|
|
|
|
|
|
|
|
#[allow(semicolon_in_expressions_from_macros)]
|
|
|
|
let _ = foo!(second);
|
|
|
|
|
|
|
|
#[allow(semicolon_in_expressions_from_macros)]
|
|
|
|
fn inner() {
|
|
|
|
let _ = foo!(third);
|
|
|
|
}
|
2021-02-03 02:40:59 -06:00
|
|
|
|
|
|
|
#[allow(semicolon_in_expressions_from_macros)]
|
|
|
|
async {
|
|
|
|
let _ = foo!(fourth);
|
|
|
|
};
|
2021-07-14 18:24:12 -05:00
|
|
|
|
|
|
|
let _ = {
|
|
|
|
foo!(warn_in_block)
|
|
|
|
};
|
|
|
|
|
|
|
|
let _ = foo!(warn_in_expr);
|
|
|
|
|
|
|
|
// This `#[allow]` does not work, since the attribute gets dropped
|
|
|
|
// when we expand the macro
|
|
|
|
let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
|
2020-12-07 17:55:00 -06:00
|
|
|
}
|