From 9f65519eb9d95cdcb001efd84e680d8a813e0623 Mon Sep 17 00:00:00 2001 From: Satvik Mishra Date: Sun, 27 Sep 2026 11:50:34 +0000 Subject: [PATCH] Clarify macro_export path-based scope example comments Both `self::m!()` and bare `m!()` at the crate root are intentional: `#[macro_export]` places the macro in the crate root. Clarify that in the example comments (crate root, not "current module") so the unqualified call is not mistaken for a typo. Fixes #1789 --- src/macros-by-example.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/macros-by-example.md b/src/macros-by-example.md index 267304c7cb..3fc3998ba5 100644 --- a/src/macros-by-example.md +++ b/src/macros-by-example.md @@ -456,9 +456,10 @@ The *`macro_export` [attribute][attributes]* exports the macro from the crate an > [!EXAMPLE] > ```rust -> self::m!(); -> // ^^^^ OK: Path-based lookup finds `m` in the current module. -> m!(); // As above. +> // With `#[macro_export]`, `m` is placed in the crate root for path-based lookup +> // (an unqualified `m!()` at the crate root finds it too): +> self::m!(); // OK: Path-based lookup finds `m` in the crate root. +> m!(); // OK: Unqualified name at the crate root also finds it. > > mod inner { > super::m!();