1*d4726bddSHONG Yifan #![feature(prelude_import)] 2*d4726bddSHONG Yifan #[prelude_import] 3*d4726bddSHONG Yifan use std::prelude::rust_2021::*; 4*d4726bddSHONG Yifan #[macro_use] 5*d4726bddSHONG Yifan extern crate std; 6*d4726bddSHONG Yifan // This differs from the edition 2015 version because it does not have an `extern proc_macro` 7*d4726bddSHONG Yifan // statement, which became optional in edition 2018. 8*d4726bddSHONG Yifan 9*d4726bddSHONG Yifan use proc_macro::TokenStream; 10*d4726bddSHONG Yifan 11*d4726bddSHONG Yifan #[proc_macro] make_answer(_item: TokenStream) -> TokenStream12*d4726bddSHONG Yifanpub fn make_answer(_item: TokenStream) -> TokenStream { 13*d4726bddSHONG Yifan "fn answer() -> u32 { 42 }".parse().unwrap() 14*d4726bddSHONG Yifan } 15*d4726bddSHONG Yifan const _: () = 16*d4726bddSHONG Yifan { 17*d4726bddSHONG Yifan extern crate proc_macro; 18*d4726bddSHONG Yifan #[rustc_proc_macro_decls] 19*d4726bddSHONG Yifan #[used] 20*d4726bddSHONG Yifan #[allow(deprecated)] 21*d4726bddSHONG Yifan static _DECLS: &[proc_macro::bridge::client::ProcMacro] = 22*d4726bddSHONG Yifan &[proc_macro::bridge::client::ProcMacro::bang("make_answer", 23*d4726bddSHONG Yifan make_answer)]; 24*d4726bddSHONG Yifan }; 25