Skip to content

Commit 5167e13

Browse files
committed
Document that derives go in the attribute sub-namespace
1 parent cc1d51c commit 5167e13

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/procedural-macros.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ These macros are defined by a [public] [function] with the `proc_macro`
9494
output [`TokenStream`] replaces the entire macro invocation.
9595
9696
r[macro.proc.function.namespace]
97-
The `proc_macro` attribute defines the macro in the [macro namespace] in the root of the crate.
97+
The `proc_macro` attribute defines the macro in the [bang-style sub-namespace][sub-namespace] of the [macro namespace] in the root of the crate.
9898
9999
For example, the following macro definition ignores its input and outputs a
100100
function `answer` into its scope.
@@ -144,7 +144,7 @@ Custom derive macros are defined by a [public] [function] with the
144144
`proc_macro_derive` attribute and a signature of `(TokenStream) -> TokenStream`.
145145

146146
r[macro.proc.derive.namespace]
147-
The `proc_macro_derive` attribute defines the custom derive in the [macro namespace] in the root of the crate.
147+
The `proc_macro_derive` attribute defines the custom derive in the [attribute sub-namespace][sub-namespace] of the [macro namespace] in the root of the crate.
148148

149149
r[macro.proc.derive.output]
150150
The input [`TokenStream`] is the token stream of the item that has the `derive`
@@ -240,7 +240,7 @@ including other [attributes] on the [item]. The returned [`TokenStream`]
240240
replaces the [item] with an arbitrary number of [items].
241241

242242
r[macro.proc.attribute.namespace]
243-
The `proc_macro_attribute` attribute defines the attribute in the [macro namespace] in the root of the crate.
243+
The `proc_macro_attribute` attribute defines the attribute in the [attribute sub-namespace][sub-namespace] of the [macro namespace] in the root of the crate.
244244

245245
For example, this attribute macro takes the input stream and returns it as is,
246246
effectively being the no-op of attributes.
@@ -399,6 +399,7 @@ their equivalent `#[doc = r"str"]` attributes when passed to macros.
399399
[item]: items.md
400400
[items]: items.md
401401
[macro namespace]: names/namespaces.md
402+
[sub-namespace]: names/namespaces.md#sub-namespaces
402403
[module]: items/modules.md
403404
[patterns]: patterns.md
404405
[public]: visibility-and-privacy.md

0 commit comments

Comments
 (0)