Skip to content

Typo? 3.1. Macros By Example / Path-Based Scope: m!(); // OK: Path-based lookup #1789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kuzminrobin opened this issue Apr 14, 2025 · 1 comment
Labels
A-macros Area: Macros Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like.

Comments

@kuzminrobin
Copy link

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.

@ehuss
Copy link
Contributor

ehuss commented Apr 14, 2025

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.

@ehuss ehuss added Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like. A-macros Area: Macros labels Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: Macros Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like.
Projects
None yet
Development

No branches or pull requests

2 participants