Skip to content

Commit 6e9fc2c

Browse files
committed
Document modules in attribute & derive macro input
1 parent 6f2d1ea commit 6e9fc2c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/macros.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,30 @@ Macros invocations can be resolved via two kinds of scopes:
108108
- [Path-based scope `macro_rules`](macros-by-example.md#r-macro.decl.scope.path-based)
109109
- [Procedural macros]
110110

111+
r[macro.invocation.attr]
112+
### Derive and attribute macro invocation
113+
114+
r[macro.invocation.attr.intro]
115+
The item a [derive macro] or [attribute macro] is applied to must be syntactically valid.
116+
117+
r[macro.invocation.attr.mod]
118+
Any [module items] present in the macros input, including [outlined modules], are passed to the macro as written in the input source:
119+
120+
- If the module has a body, the body is part of the input.
121+
- If the module does not have a body (the module is [outlined][outlined modules]), the body is not part of the input.
122+
111123
[External blocks]: items/external-blocks.md
112124
[Macros by Example]: macros-by-example.md
113125
[Procedural Macros]: procedural-macros.md
114126
[`macro_rules`]: macros-by-example.md
115127
[associated items]: items/associated-items.md
128+
[attribute macro]: procedural-macros.md#r-macro.proc.attribute
116129
[delimiters]: tokens.md#delimiters
130+
[derive macro]: procedural-macros.md#r-macro.proc.derive
117131
[expressions]: expressions.md
118132
[items]: items.md
133+
[module items]: items/modules.md
134+
[outlined modules]: items/modules.md#r-items.mod.outlined
119135
[patterns]: patterns.md
120136
[statements]: statements.md
121137
[types]: types.md

0 commit comments

Comments
 (0)