2018-11-24 15:34:13 +02:00
|
|
|
// force-host
|
2017-03-17 23:41:09 +00:00
|
|
|
// no-prefer-dynamic
|
|
|
|
|
|
|
|
#![crate_type = "proc-macro"]
|
2019-08-20 02:26:40 +03:00
|
|
|
#![feature(proc_macro_quote)]
|
2017-03-17 23:41:09 +00:00
|
|
|
|
|
|
|
extern crate proc_macro;
|
|
|
|
|
2018-04-02 08:19:32 -07:00
|
|
|
use proc_macro::*;
|
2016-08-29 16:16:43 +12:00
|
|
|
|
2017-03-17 23:41:09 +00:00
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn attr_tru(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
2018-08-23 09:35:49 -04: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 16:16:43 +12: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 16:16:43 +12: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 16:16:43 +12: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 16:16:43 +12: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 16:16:43 +12:00
|
|
|
}
|