dtolnay / paste

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

can't concat namespace #16

Closed s97712 closed 4 years ago

s97712 commented 4 years ago

I tried concat namespace using following code

macro_rules! call {
  ($path: expr) => {
    [<$path::call>]()
  };
}

And get compile error

error: expected `::`, found `]`
  --> .../src/lib.rs:20:11
   |
20 |           [<$path::call>]()
   |           ^^^^^^^^^^^^^^^ expected `::`

Consider supporting namespace ?

dtolnay commented 4 years ago

I would prefer to stick to concatenating identifiers, but someone could make a different crate focused on paths.

FWIW you don't need a proc macro to concatenate paths if you use $($seg:ident)::* instead of expr.