2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2024-04-07 00:33:37 +02:00
|
|
|
//@ compile-flags: --cfg foo --check-cfg=cfg(foo)
|
2013-06-22 13:20:00 +10:00
|
|
|
|
|
|
|
// check that cfg correctly chooses between the macro impls (see also
|
|
|
|
// cfg-macros-notfoo.rs)
|
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2013-06-22 13:20:00 +10:00
|
|
|
#[cfg(foo)]
|
2014-12-18 20:48:26 -08:00
|
|
|
#[macro_use]
|
2013-06-22 13:20:00 +10:00
|
|
|
mod foo {
|
|
|
|
macro_rules! bar {
|
|
|
|
() => { true }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(foo))]
|
2014-12-18 20:48:26 -08:00
|
|
|
#[macro_use]
|
2013-06-22 13:20:00 +10:00
|
|
|
mod foo {
|
|
|
|
macro_rules! bar {
|
|
|
|
() => { false }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-03 15:30:54 -08:00
|
|
|
pub fn main() {
|
2013-06-22 13:20:00 +10:00
|
|
|
assert!(bar!())
|
|
|
|
}
|