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