Skip to content

Commit f081289

Browse files
committed
Revise proc_macro text
1 parent e49d5d9 commit f081289

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/procedural-macros.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ r[macro.proc.proc_macro]
8585
## The `proc_macro` attribute
8686
8787
r[macro.proc.proc_macro.intro]
88-
The *`proc_macro` [attribute][attributes]* defines a procedural macro for [function-like macros][macro.invocation].
88+
The *`proc_macro` [attribute][attributes]* defines a [function-like][macro.invocation] procedural macro.
8989
9090
> [!EXAMPLE]
91-
> The following macro definition ignores its input and outputs a function `answer` into its scope.
91+
> This macro definition ignores its input and emits a function `answer` into its scope.
9292
>
9393
> <!-- ignore: test doesn't support proc-macro -->
9494
> ```rust,ignore
@@ -102,7 +102,7 @@ The *`proc_macro` [attribute][attributes]* defines a procedural macro for [funct
102102
> }
103103
> ```
104104
>
105-
> And then we use it in a binary crate to print "42" to standard output.
105+
> We can use it in a binary crate to print "42" to standard output.
106106
>
107107
> <!-- ignore: requires external crates -->
108108
> ```rust,ignore
@@ -120,7 +120,7 @@ r[macro.proc.proc_macro.syntax]
120120
The `proc_macro` attribute uses the [MetaWord] syntax.
121121
122122
r[macro.proc.proc_macro.allowed-positions]
123-
The `proc_macro` attribute may only be applied to a function with the signature of `pub fn(TokenStream) -> TokenStream` where [`TokenStream`] comes from the [`proc_macro` crate]. It must have the ["Rust" ABI][items.fn.extern]. No other function qualifiers are allowed.
123+
The `proc_macro` attribute may only be applied to a `pub` function of type `fn(TokenStream) -> TokenStream` where [`TokenStream`] comes from the [`proc_macro` crate]. It must have the ["Rust" ABI][items.fn.extern]. No other function qualifiers are allowed. It must be located in the root of the crate.
124124
125125
r[macro.proc.proc_macro.duplicates]
126126
The `proc_macro` attribute may only be specified once on a function.
@@ -129,18 +129,18 @@ r[macro.proc.proc_macro.namespace]
129129
The `proc_macro` attribute publicly defines the macro in the [macro namespace] in the root of the crate with the same name as the function.
130130
131131
r[macro.proc.proc_macro.behavior]
132-
A function-like macro invocation of a function-like procedural macro will pass what is inside the delimiters of the macro invocation as the input [`TokenStream`] argument, and replace the entire macro invocation with the output [`TokenStream`] of the function.
132+
A function-like macro invocation of a function-like procedural macro will pass what is inside the delimiters of the macro invocation as the input [`TokenStream`] argument and replace the entire macro invocation with the output [`TokenStream`] of the function.
133133
134134
r[macro.proc.proc_macro.invocation]
135135
Function-like procedural macros may be invoked in any macro invocation position, which includes:
136136
137-
- [statements]
138-
- [expressions]
139-
- [patterns]
140-
- [type expressions]
141-
- [item] positions, including items in [`extern` blocks]
142-
- inherent and trait [implementations]
143-
- [trait definitions]
137+
- [Statements]
138+
- [Expressions]
139+
- [Patterns]
140+
- [Type expressions]
141+
- [Item] positions, including items in [`extern` blocks]
142+
- Inherent and trait [implementations]
143+
- [Trait definitions]
144144
145145
<!-- template:attributes -->
146146
r[macro.proc.derive]

0 commit comments

Comments
 (0)