You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/procedural-macros.md
+4-12Lines changed: 4 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,20 +83,15 @@ r[macro.proc.function]
83
83
## Function-like procedural macros
84
84
85
85
r[macro.proc.function.intro]
86
-
*Function-like procedural macros* are procedural macros that are invoked using
87
-
the macro invocation operator (`!`).
86
+
*Function-like procedural macros* are procedural macros that are invoked using the macro invocation operator (`!`).
88
87
89
88
r[macro.proc.function.def]
90
-
These macros are defined by a [public] [function] with the `proc_macro`
91
-
[attribute] and a signature of `(TokenStream) -> TokenStream`. The input
92
-
[`TokenStream`] is what is inside the delimiters of the macro invocation and the
93
-
output [`TokenStream`] replaces the entire macro invocation.
89
+
These macros are defined by a [public] [function] with the `proc_macro` [attribute] and a signature of `(TokenStream) -> TokenStream`. The input [`TokenStream`] is what is inside the delimiters of the macro invocation and the output [`TokenStream`] replaces the entire macro invocation.
94
90
95
91
r[macro.proc.function.namespace]
96
92
The `proc_macro` attribute defines the macro in the [macro namespace] in the root of the crate.
97
93
98
-
For example, the following macro definition ignores its input and outputs a
99
-
function `answer` into its scope.
94
+
For example, the following macro definition ignores its input and outputs a function `answer` into its scope.
100
95
101
96
<!-- ignore: test doesn't support proc-macro -->
102
97
```rust,ignore
@@ -125,10 +120,7 @@ fn main() {
125
120
```
126
121
127
122
r[macro.proc.function.invocation]
128
-
Function-like procedural macros may be invoked in any macro invocation
129
-
position, which includes [statements], [expressions], [patterns], [type
130
-
expressions], [item] positions, including items in [`extern` blocks], inherent
131
-
and trait [implementations], and [trait definitions].
123
+
Function-like procedural macros may be invoked in any macro invocation position, which includes [statements], [expressions], [patterns], [type expressions], [item] positions, including items in [`extern` blocks], inherent and trait [implementations], and [trait definitions].
0 commit comments