rust/tests/ui/proc-macro/auxiliary/attr-cfg.rs
2023-01-11 09:32:08 +00:00

22 lines
409 B
Rust

// 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
}