I'm working on a proc macro that will be a helper for a parent crate: https://github.com/zbraniecki/tinystr/blob/macros/macros/src/lib.rs#L17
It works really well and allows me to call it in the parent with no dependencies: https://github.com/zbraniecki/tinystr/blob/macros/tests/main.rs#L521
But when I try to add $crate::
to the TokenStream, it errors out with:
error: expected expression, found `$`
--> tests/macros.rs:12:14
|
12 | let x2 = tinystr4!("foo");
| ^^^^^^^^^^^^^^^^ expected expression
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
error: could not compile `tinystr-macros`.
To learn more, run the command again with --verbose.
I thought it may be https://github.com/rust-lang/rust/pull/73345 which got fixed in Nightly recently, but no luck - same error in today's nightly.
Is there any way to use $crate
in such scenario?