Like this:
cargo new foo
cd foo
echo "struct A; fn main() { let _ = foo::A; }" > foo/src/main.rs
cargo b
Then compile failed:
The purpose of it is that, I want to write a proc_macro in crate foo_macros
, for all of user and crate foo
use.
#[proc_macro]
pub fn a(input: TokenStream) -> TokenStream {
(quote! {
foo::A
}).into()
}
it is OK when using in user crate, but failed when using in foo crate.