the error for this example is lacking:
pub mod foo {
pub mod bar {
pub mod baz {
#[macro_export]
macro_rules! m {
() => {}
}
}
}
}
foo::bar::baz::m! {}
this makes sense, because macros 1.0 path resolution rules is very different from regular item name resolution, but it could benefit from a better explanation and note, such as a hint to use m! {}
instead (since the macro was exported)
I started some work on this on my machine but hit a wall here:
looking to pick up the work eventually but as long as I can't figure out how to create this root path I can't advance
This is a proble that looks like a Pandora's box, there are previous problem that are similar and also impact this aread like https://internals.rust-lang.org/t/pub-on-macro-rules/19358
However, due that Artur do not find any help on the general rust chat on zulip, we can resurrect the chat on the wg-macro stream and also Vincent can help with this because I was already on macro resolution code in the past. In conclusion, we discuss if it is workted spend time of improve usability on the currentl macro rule instead of moving directly to macros 2.0. As the idea of spend time on a subsystem that eventually will be replaced in the future sounds a not a good place where spend times, we think also that improve the current macro_rule in any way can help us to undestand what we want in the macros 2.0 (also reading club can help here).
On my end it's mostly pondering about these kind of 80-20 (Pareto principle) macro features which could already go a long way.
generics may be too big of a topic for a first call, so we may want to punt on talking about it for now;
the :empty
, or more generally, :verbatim[tokens here]
matcher, however, seems more tractable
macro_rules! example {(
$($unsafe:verbatim[unsafe])? fn …
) => (
$($unsafe)? fn
)}
Also, disclaimer that I don't know how much I may be contributing to actual compiler implementations myself, since I'm not necessarily well acquainted with compiler code; I talk and contribute mostly off user experience with macro usage.
Where do we start? Perhaps beginning with a topic like the first point might not be ideal for the wg, especially since we're just getting started. However, reflecting on the challenges of the current macros system, as mentioned in point 2, would be beneficial. At the same time, we should prioritize usability and diagnostic improvements.
I've been busy with trying to shove implement Hygiene into rust-analyzer, so far rather unsuccessful, so nothing to raise from my side.
We discuss a little bit macros resolution in rust analyzer and Hygiene, just generic chatting.
Some generic chat that do not fix in the topic section are the following topics:
:empty
matcher: https://rust-lang.zulipchat.com/#narrow/stream/404510-wg-macros/topic/Spitballing.3A.20.60.3Aempty.60.20matcher