Skip to content

Commit f873453

Browse files
ehusstraviscross
authored andcommitted
Add macro_export template rules
1 parent 57af92a commit f873453

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/macros-by-example.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,21 @@ Macros labeled with `#[macro_export]` are always `pub` and can be referred to by
395395
> }
396396
> ```
397397
398+
r[macro.decl.scope.macro_export.syntax]
399+
The `macro_export` attribute uses the [MetaWord] syntax, or the [MetaListIdents] syntax with a single value of [`local_inner_macros`][macro.decl.scope.macro_export.local_inner_macros].
400+
401+
r[macro.decl.scope.macro_export.allowed-positions]
402+
The `macro_export` attribute can be applied to `macro_rules` definitions.
403+
404+
> [!NOTE]
405+
> `rustc` currently warns in other positions, but this may be rejected in the future.
406+
407+
r[macro.decl.scope.macro_export.duplicates]
408+
Only the first instance of `macro_export` on a macro is honored. Subsequent `macro_export` attributes are ignored.
409+
410+
> [!NOTE]
411+
> `rustc` currently warns on subsequent duplicate `macro_export` attributes.
412+
398413
r[macro.decl.hygiene]
399414
## Hygiene
400415

0 commit comments

Comments
 (0)