This repository has been archived by the owner on Oct 6, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 59
$crate is not a valid identifier inside paste::item! #3
Comments
This looks like a rustc bug because I can reproduce it without any libraries. repro/src/lib.rsextern crate proc_macro;
use self::proc_macro::TokenStream;
#[proc_macro]
pub fn repro(input: TokenStream) -> TokenStream {
input.into_iter().next();
unimplemented!()
} testing/src/lib.rsmacro_rules! m {
() => {
repro::repro!($crate);
};
}
m!(); error: proc macro panicked
--> src/main.rs:3:9
|
3 | repro::repro!($crate);
| ^^^^^^^^^^^^^^^^^^^^^^
...
7 | m!();
| ----- in this macro invocation
|
= help: message: `"$crate"` is not a valid identifier |
Moved upstream: rust-lang/rust#55640. |
Thanks @dtolnay |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
demo reproduction here https://github.com/dtolnay/paste/pull/2/files
I found that Im not able to refer to a crate local macro inside a
paste::item!
block, that is the ability to express$crate::foo!
which is required to enable rust 2018 style imports ( aka ditching#[macro_use]
.The specific context is here where I'm using paste to generate idents which are inputs for another crate local macro
The text was updated successfully, but these errors were encountered: