Clarify macro_export path-based scope example comments - #2367
Open
SatvikMishra08 wants to merge 1 commit into
Open
SatvikMishra08 wants to merge 1 commit into
SatvikMishra08 wants to merge 1 commit into
Conversation
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 rust-lang#1789
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verified against the language (
rustc): bothself::m!()and barem!()at the crate root are intentional once#[macro_export]placesmin the crate root. Nestedself::m!()/ barem!()fail;crate::m!()works.This updates the example comments to say crate root (matching the surrounding prose and @ehuss’s note on #1789) and to state that the unqualified call is also expected — rather than deleting a correct line.
Test plan
self::fail inside a nested module without a path to the crate rootmacro_exportexampleFixes #1789