Stream: t-compiler/wg-rls-2.0

Topic: local_inner_macros ?


Edwin Cheng (Mar 28 2020 at 13:42, on Zulip):

In rust-analyzer#3712, there is a bug related to lack of implementation of local_inner_macros. I want to try to implement it , but its name resolution is so strange that I don't know how we could handle properly :

The local_inner_macros modifier resolves all macro invocations made from within that macro as macros in the same crate. So if info! expands to an invocation of log! then this would be resolved as $crate::log! rather than requiring the caller to have log in scope.

(Copy from https://github.com/rust-lang/log/pull/288)

@matklad Any idea ?

matklad (Mar 29 2020 at 17:21, on Zulip):

I would say that we should store the precense of #[local_inner_macros] on the Hygiene struct, and use that during name resolution

Edwin Cheng (Mar 29 2020 at 17:40, on Zulip):

I am a little bit lost here. is Hygiene struct belongs to call-site, not def-site ?

matklad (Mar 29 2020 at 18:21, on Zulip):

Hygiene kinda both; At the moment it stores the def_crate, which is exactly what is needed for local inner macros

Last update: May 29 2020 at 18:05UTC