summaryrefslogtreecommitdiffstats
path: root/tests/ui/proc-macro/auxiliary/attr-cfg.rs
blob: 2f0054cc14aa6454005f2889292acc42824b2c9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_attribute]
pub fn attr_cfg(args: TokenStream, input: TokenStream) -> TokenStream {
    let input_str = input.to_string();

    assert_eq!(input_str, "fn outer() -> u8
{
    #[cfg(foo)] fn inner() -> u8 { 1 } #[cfg(bar)] fn inner() -> u8 { 2 }
    inner()
}");

    input
}