-
Notifications
You must be signed in to change notification settings - Fork 13.4k
docs: make some text changes on Section Macros
#32509
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -337,8 +337,8 @@ fn main() { | ||||||||||
} | |||||||||||
``` | |||||||||||
|
|||||||||||
Instead you need to pass the variable name into the invocation, so it’s tagged | |||||||||||
with the right syntax context. | |||||||||||
Instead you need to pass the variable name into the invocation, so that it’s | |||||||||||
tagged with the right syntax context. | |||||||||||
|
|||||||||||
```rust | |||||||||||
macro_rules! foo { | |||||||||||
|
@@ -470,7 +470,7 @@ which syntactic form it matches. | ||||||||||
* `ty`: a type. Examples: `i32`; `Vec<(char, String)>`; `&T`. | |||||||||||
* `pat`: a pattern. Examples: `Some(t)`; `(17, 'a')`; `_`. | |||||||||||
* `stmt`: a single statement. Example: `let x = 3`. | |||||||||||
* `block`: a brace-delimited sequence of statements. Example: | |||||||||||
* `block`: a brace-delimited sequence of statements and optional an expression. Example: | |||||||||||
`{ log(error, "hi"); return 12; }`. | |||||||||||
* `item`: an [item][item]. Examples: `fn foo() { }`; `struct Bar;`. | |||||||||||
* `meta`: a "meta item", as found in attributes. Example: `cfg(target_os = "windows")`. | |||||||||||
|
@@ -509,7 +509,7 @@ A macro defined within the body of a single `fn`, or anywhere else not at | ||||||||||
module scope, is visible only within that item. | |||||||||||
|
|||||||||||
If a module has the `macro_use` attribute, its macros are also visible in its | |||||||||||
parent module after the child’s `mod` item. If the parent also has `macro_use` | |||||||||||
parent module after its `mod` item. If the parent also has `macro_use` | |||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually think this is worse. Not to say the wording was perfect before, but now it's not clear whether "its" refers to the parent module or the child module. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I agree,
and I thought the second one was better, and got Thanks again. |
|||||||||||
then the macros will be visible in the grandparent after the parent’s `mod` | |||||||||||
item, and so forth. | |||||||||||
|
|||||||||||
|
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 should be "optionally"
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.
Yes, you are right. Thanks for your suggestion.