You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recursive macro call inside concat macro fails to find macros referred to by $crate #63460
Compiling playground v0.0.1 (/playground)
error[E0433]: failed to resolve: could not find `separator` in `$crate`
--> src/main.rs:9:29
|
9 | concat!($e, $crate::separator!(), $crate::concat_separator!($($other),+))
| ^^^^^^^^^ could not find `separator` in `$crate`
...
17 | println!("{}", concat_separator!(2, 3, 4))
| -------------------------- in this macro invocation
error[E0433]: failed to resolve: could not find `concat_separator` in `$crate`
--> src/main.rs:9:51
|
9 | concat!($e, $crate::separator!(), $crate::concat_separator!($($other),+))
| ^^^^^^^^^^^^^^^^ could not find `concat_separator` in `$crate`
...
17 | println!("{}", concat_separator!(2, 3, 4))
| -------------------------- in this macro invocation
If either the recursion (playground) or the concat! is removed (playground), this compiles exactly as expected. Additionally, if I explicitly name my crate, it works as expected, but would be vulnerable to crate renames in user code (can't reproduce in playground because it doesn't build a library).
If you try and build Rustup, you get a similar failure, but without recursion or $crate. Seems that just using another macro and concat is enough in some circumstances
Activity
nrc commentedon Aug 12, 2019
If you try and build Rustup, you get a similar failure, but without recursion or
$crate. Seems that just using another macro andconcatis enough in some circumstancestesuji commentedon Aug 18, 2019
cc @petrochenkov for the hygiene macro in #63535
tesuji commentedon Aug 18, 2019
petrochenkov commentedon Aug 18, 2019
@lzutao
Please, file a separate issue for the regression, I'll prioritize it over pre-existing issues (which the original issue seems to be).
tesuji commentedon Aug 18, 2019
Thanks, I filed it in #63685
Add a regression test for issue rust-lang#63460
petrochenkov commentedon Aug 21, 2019
Fixed in #63717.
Rollup merge of rust-lang#63717 - petrochenkov:eager, r=matthewjasper
cwfitzgerald commentedon Aug 21, 2019
Thanks for your work on this!
Add a regression test for issue rust-lang#63460
Add a regression test for issue rust-lang#63460