Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

#[proc_macro_hack] reexport cannot handle leading :: in path #36

Closed
danielhenrymantilla opened this issue Jul 5, 2019 · 1 comment · Fixed by #37
Closed

#[proc_macro_hack] reexport cannot handle leading :: in path #36

danielhenrymantilla opened this issue Jul 5, 2019 · 1 comment · Fixed by #37

Comments

@danielhenrymantilla
Copy link

As we can see from the code, when using the #[proc_macro_hack] attribute to "decorate" a reexport (i.e., in the "declaration crate"), it expects to start parsing

use $implementation_crate_name:ident ::

However, given that we are reexporting from a crate, a way to do this in the 2018 edition (the cleanest way imho, since it avoids any potential path ambiguity), would be to use a leading pair of colons:

#[proc_macro_hack]
use ::implementation_crate_name::proc_macro_name;

That's why it would be great if proc_macro_hack in reexport position was changed so that it expects to start parsing

use $(::)? $implementation_crate_name:ident ::
@dtolnay
Copy link
Owner

dtolnay commented Jul 5, 2019

Thanks, I would accept a PR to fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants