I have this test:
mod tests {
use crate::str2code;
#[test]
fn test() {
str2code!(r#"println!("Hello, world!");"#);
}
}
The str2code macro is a procedural macro that I made.
#[proc_macro]
pub fn str2code(input: TokenStream) -> TokenStream
It gives this error:
error: can't use a procedural macro from the same crate that defines it
--> src\lib.rs:31:9
|
31 | str2code!(r#"println!("Hello, world!");"#);
| ^^^^^^^^
Why does the compiler not let me test my macros and why does this exist?
I have this test:
The
str2codemacro is a procedural macro that I made.It gives this error:
Why does the compiler not let me test my macros and why does this exist?