I followed the tutorial on Procedual Macro, and I am using the Rust version 1.15 (also I tested nightly 1.16). However when I use cargo build to build the hello-world project, it failed with information:
error: invalid format string: expected `'}'`, found `']'`
--> src/main.rs:17:1
|
17 | #[derive(HelloWorld)]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate
error: aborting due to previous error
error: Could not compile `hello-world`.
The source code are presented in git@github.com:qorost/procedural-macro-demo.git
Yes, code generation is tricky like that, and the error doesn't do a good job of tracing the true origin, just "outside the current crate". The quote! is what let this code compile fine into hello-world-derive, because it wasn't actually doing anything yet.