I've implemented a crate for defining several related structures all inside a procedural macro.
I'd find it useful to support something like:
smodel! {
type Arena = Arena;
include!("foo.rs");
include!("bar.rs");
include!("qux.rs");
}
I'd manually parse these include!(...);
calls and expand them to what I expect. Is this somehow possible?
I'm also afraid that the IDE would only discover the file if there is a built-in mechanism for properly including the Rust file in proc_macro
.
chrefr
2
Can't you just emit those include!()
s in the generated code?
Anyway, you can get the current file path with the experimental span API, and then you can access the file and read it.
The problem is that I need to parse the include!()
contents for processing purposes.
I also need to get rustc compilation errors in the include!()
d file as if it were part of the Rust source tree.
Someone already proposed it though:
system
Closed
4
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.