-
Couldn't load subscription status.
- Fork 557
Update macro_use to use the attribute template
#1886
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
Conversation
16b3c45 to
c4fff54
Compare
This comment has been minimized.
This comment has been minimized.
874ab7a to
e594bec
Compare
This comment has been minimized.
This comment has been minimized.
More closely align with the template, and some minor word tweaks.
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| ```rust,ignore | ||
| #[macro_use(lazy_static)] // Or #[macro_use] to import all macros. | ||
| extern crate lazy_static; | ||
| Macros imported this way are imported into the [`macro_use` prelude], not textually, which means that they can be shadowed by any other name. While macros imported by `macro_use` can be used before the import statement, in case of a conflict, the last macro imported wins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that we document that the last macro wins.
I always wanted to rework this into the standard order-independent scheme with "glob imports" (#[macro_use]), "single imports" shadowing glob imports (#[macro_use(single)]), and glob-vs-glob conflicts reported on use.
We should be able to do in practice, I think, so it would be good to leave unspecified what happens in case of conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good issue to cite for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New rules:
macro.decl.scope.macro_use.intromacro.decl.scope.macro_use.syntaxmacro.decl.scope.macro_use.allowed-positionsmacro.decl.scope.macro_use.duplicates