blob: 4e5d22e6e3ecef44ee8d87b217e4a65bfc541da6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::*;
#[proc_macro]
pub fn lifetimes_bang(input: TokenStream) -> TokenStream {
// Roundtrip through token trees
input.into_iter().collect()
}
#[proc_macro_attribute]
pub fn lifetimes_attr(_: TokenStream, input: TokenStream) -> TokenStream {
// Roundtrip through AST
input
}
#[proc_macro_derive(Lifetimes)]
pub fn lifetimes_derive(input: TokenStream) -> TokenStream {
// Roundtrip through a string
format!("mod m {{ {} }}", input).parse().unwrap()
}
|