2018-11-24 07:34:13 -06:00
|
|
|
//@ force-host
|
2017-03-17 18:41:09 -05:00
|
|
|
//@ no-prefer-dynamic
|
|
|
|
|
|
|
|
#![crate_type = "proc-macro"]
|
2019-08-19 18:26:40 -05:00
|
|
|
#![feature(proc_macro_quote)]
|
2017-03-17 18:41:09 -05:00
|
|
|
|
|
|
|
extern crate proc_macro;
|
|
|
|
|
2018-04-02 10:19:32 -05:00
|
|
|
use proc_macro::*;
|
2016-08-28 23:16:43 -05:00
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn attr_tru(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
2018-08-23 08:35:49 -05:00
|
|
|
let name = item.into_iter().nth(1).unwrap();
|
2017-03-17 18:41:09 -05:00
|
|
|
quote!(fn $name() -> bool { true })
|
2016-08-28 23:16:43 -05:00
|
|
|
}
|
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn attr_identity(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
2017-03-14 17:04:46 -05:00
|
|
|
quote!($item)
|
2016-08-28 23:16:43 -05:00
|
|
|
}
|
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
#[proc_macro]
|
|
|
|
pub fn tru(_ts: TokenStream) -> TokenStream {
|
2017-03-14 17:04:46 -05:00
|
|
|
quote!(true)
|
2016-08-28 23:16:43 -05:00
|
|
|
}
|
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
#[proc_macro]
|
|
|
|
pub fn ret_tru(_ts: TokenStream) -> TokenStream {
|
2017-03-14 17:04:46 -05:00
|
|
|
quote!(return true;)
|
2016-08-28 23:16:43 -05:00
|
|
|
}
|
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
#[proc_macro]
|
|
|
|
pub fn identity(ts: TokenStream) -> TokenStream {
|
2017-03-14 17:04:46 -05:00
|
|
|
quote!($ts)
|
2016-08-28 23:16:43 -05:00
|
|
|
}
|