diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/proc-macro/attr-cfg.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/proc-macro/attr-cfg.rs b/src/test/ui/proc-macro/attr-cfg.rs new file mode 100644 index 000000000..2aed9e2e8 --- /dev/null +++ b/src/test/ui/proc-macro/attr-cfg.rs @@ -0,0 +1,27 @@ +// 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); +} |