reference
reference copied to clipboard
Typo? 3.1. Macros By Example / Path-Based Scope: `m!(); // OK: Path-based lookup`
I suspect a typo.
Fragment of interest:
self::m!();
m!(); // OK: Path-based lookup finds m in the current module.
I suspect it must be:
self::m!(); // OK: Path-based lookup finds m in the current module.
i.e. the fragment m!(); must not be there.
I'm relatively new to Rust, still studying it. I can be wrong. But I have an intuitive described above suspicion of a typo. If that's not a typo then an extra explanation would help.
I think the original is correct, in that it is trying to illustrate that just a bare m works by resolving from the crate root.
I can see that it is a little confusing to have that comment on just that one line. I would maybe remove that comment and add a comment at the top of the example with something like:
// OK: Path-based lookup finds m in the crate root.