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