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

Provide access to $crate in the macro impl #19

Closed
carllerche opened this issue Mar 14, 2018 · 4 comments
Closed

Provide access to $crate in the macro impl #19

carllerche opened this issue Mar 14, 2018 · 4 comments

Comments

@carllerche
Copy link

I'm not sure this is possible, but it is a follow up from our talk on IRC.

I'm wondering if it would be possible for the decl macro to include $crate in the enum ProcMacroHack.

This would help dealing with cases where the caller renames the extern crate that has the macro def.

@dtolnay
Copy link
Owner

dtolnay commented Mar 19, 2018

I tried this and it seems to work as I would expect on Rust 1.24 (but not earlier versions) edad180. I will try to see if we can provide an implementation that would work on older compilers.

@dtolnay
Copy link
Owner

dtolnay commented Mar 19, 2018

Here is a sketchy modification that seems to make it work on any version of Rust. 1e15278

@dtolnay
Copy link
Owner

dtolnay commented Mar 19, 2018

The sketchy way works for expression macros but not item macros. I would be okay making that change. @carllerche for your use case do you need this to work in item macros? I think that may be more complicated.

@dtolnay
Copy link
Owner

dtolnay commented Jul 3, 2019

Closing in favor of rust-lang/rust#62325.

@dtolnay dtolnay closed this as completed Jul 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants