dtolnay / paste

Macros for all your token pasting needs
Apache License 2.0
1.02k stars 56 forks source link

"Expected identifier after `:`" error when `::` is used inside attribute #70

Closed SabrinaJewson closed 2 years ago

SabrinaJewson commented 2 years ago

This simple example:

macro_rules! a { (#[x = $x:ty]) => {}; }
paste::paste!(a!(#[x = foo::Bar]));

Fails with the error message:

error: expected identifier after `:`
 --> src/lib.rs:3:27
  |
3 | paste::paste!(a!(#[x = foo::Bar]));
  |                           ^^

It seems like paste! is treating the attribute as a doc attribute even though it isn't.

dtolnay commented 2 years ago

Good catch. I've published a fix in 1.0.6.