mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
28 lines
351 B
Rust
28 lines
351 B
Rust
// run-pass
|
|
// aux-build:attr-cfg.rs
|
|
// revisions: foo bar
|
|
|
|
extern crate attr_cfg;
|
|
use attr_cfg::attr_cfg;
|
|
|
|
#[attr_cfg]
|
|
fn outer() -> u8 {
|
|
#[cfg(foo)]
|
|
fn inner() -> u8 { 1 }
|
|
|
|
#[cfg(bar)]
|
|
fn inner() -> u8 { 2 }
|
|
|
|
inner()
|
|
}
|
|
|
|
#[cfg(foo)]
|
|
fn main() {
|
|
assert_eq!(outer(), 1);
|
|
}
|
|
|
|
#[cfg(bar)]
|
|
fn main() {
|
|
assert_eq!(outer(), 2);
|
|
}
|