2019-09-16 15:45:13 -05:00
|
|
|
#![feature(stmt_expr_attributes)]
|
|
|
|
|
|
|
|
// Test that various placements of the inner attribute are parsed correctly,
|
|
|
|
// or not.
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let a = #![allow(warnings)] (1, 2);
|
|
|
|
//~^ ERROR an inner attribute is not permitted in this context
|
|
|
|
|
|
|
|
let b = (#![allow(warnings)] 1, 2);
|
2021-03-19 18:52:07 -05:00
|
|
|
//~^ ERROR an inner attribute is not permitted in this context
|
2019-09-16 15:45:13 -05:00
|
|
|
|
|
|
|
let c = {
|
|
|
|
#![allow(warnings)]
|
|
|
|
(#![allow(warnings)] 1, 2)
|
2021-03-19 18:52:07 -05:00
|
|
|
//~^ ERROR an inner attribute is not permitted in this context
|
2019-09-16 15:45:13 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
let d = {
|
|
|
|
#![allow(warnings)]
|
|
|
|
let e = (#![allow(warnings)] 1, 2);
|
2021-03-19 18:52:07 -05:00
|
|
|
//~^ ERROR an inner attribute is not permitted in this context
|
2019-09-16 15:45:13 -05:00
|
|
|
e
|
|
|
|
};
|
2021-03-19 18:52:07 -05:00
|
|
|
|
|
|
|
let e = [#![allow(warnings)] 1, 2];
|
|
|
|
//~^ ERROR an inner attribute is not permitted in this context
|
|
|
|
|
|
|
|
let f = [#![allow(warnings)] 1; 0];
|
|
|
|
//~^ ERROR an inner attribute is not permitted in this context
|
|
|
|
|
|
|
|
let g = match true { #![allow(warnings)] _ => {} };
|
2021-05-11 14:21:54 -05:00
|
|
|
|
2021-03-19 18:52:07 -05:00
|
|
|
|
|
|
|
struct MyStruct { field: u8 }
|
|
|
|
let h = MyStruct { #![allow(warnings)] field: 0 };
|
|
|
|
//~^ ERROR an inner attribute is not permitted in this context
|
2019-09-16 15:45:13 -05:00
|
|
|
}
|