blob: df6e7880eb1755acb0bfe2e480554569afca1f62 [file]
#![feature(stmt_expr_attributes)]
#![feature(custom_test_frameworks)]
#[derive(Clone)]
enum E {
V1 = #[cfg(true)] 1,
//~^ ERROR `cfg` is not supported in this position
//~| ERROR `cfg` is not supported in this position
V2 = #[cfg_attr(true, cfg(true))] 2,
//~^ ERROR `cfg` is not supported in this position
}
macro_rules! mac {
($expr:expr) => { $expr.clone() }
}
fn main() {
let _ = 1 + #[cfg(unix)] 2;
//~^ ERROR `cfg` is not supported in this position
let _ = 1 + #[cfg(windows)] 2;
//~^ ERROR `cfg` is not supported in this position
let _ = 1 + #[cfg(all())] 2;
//~^ ERROR `cfg` is not supported in this position
let _ = #[cfg(false)] ();
//~^ ERROR `cfg` is not supported in this position
let _ = 1 + 2 + #[cfg(false)] 3;
//~^ ERROR `cfg` is not supported in this position
let _ = [1, 2, 3][#[cfg(false)] 1];
//~^ ERROR `cfg` is not supported in this position
let _ = mac!(#[cfg(true)] 10);
//~^ ERROR `cfg` is not supported in this position
let _ = #[cfg(true)] ();
//~^ ERROR `cfg` is not supported in this position
let _ = 1 + 2 + #[cfg(true)] 3;
//~^ ERROR `cfg` is not supported in this position
let _ = [1, 2, 3][#[cfg(true)] 1];
//~^ ERROR `cfg` is not supported in this position
}