mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-20 16:56:05 +00:00
18 lines
335 B
Rust
18 lines
335 B
Rust
#![feature(proc_macro_quote)]
|
|
|
|
extern crate proc_macro;
|
|
use proc_macro::{TokenStream, quote};
|
|
|
|
#[proc_macro]
|
|
pub fn make_it(input: TokenStream) -> TokenStream {
|
|
// `quote!` applies def-site hygiene
|
|
quote! {
|
|
trait Foo {
|
|
fn my_fn(&self) {}
|
|
}
|
|
|
|
impl<T> Foo for T {}
|
|
"a".my_fn();
|
|
}
|
|
}
|