-
I was playing arround with proc-marcos and tried todo a simple one: #![feature(proc_macro_span)]
use proc_macro::{Span, TokenStream};
extern crate proc_macro;
#[proc_macro]
pub fn declare_module(raw: TokenStream) -> TokenStream {
let mut path = Span::call_site().source_file().path();
let input = syn::parse_macro_input!(raw as syn::Ident);
path.pop();
path.push(format!("{}.rs", input.to_string()));
let text_file = std::fs::read_to_string(path).unwrap();
return text_file.parse().unwrap();
} If I try to run it, it compiles and runs ok but during development r-a doesn't expand the macro, if I replace this logic by just I also run the vscode command: I can't find any error log for r-a in vscode, so I'm wondering if I can do something to make it work or if it is at all supported |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Most of the |
Beta Was this translation helpful? Give feedback.
-
That explains it, thanks 😄 |
Beta Was this translation helpful? Give feedback.
Most of the
proc_macro_span
feature is currently unimplemented in r-a