I have a crate that is intended to be used in proc-macro
crates but it's not a proc-macro
on itself. So when I try to write an example in doc comments, say
extern crate proc_macro;
extern crate my_lib;
#[proc_macro_derive(Hello)]
fn hello(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
// examples ...
}
cargo test
fails with something like
error: the
#[proc_macro_derive]
attribute is only usable with crates of theproc-macro
crate type
--> src/multi.rs:13:1
|
7 | #[proc_macro_derive(Hello)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
So i had to mark all such examples as ignore
.
Is there any way to make this work?