Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update now that proc macros can expand to macro_rules. #694

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/procedural-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ fn main() {
```

Function-like procedural macros may expand to a [type] or any number of
[items]. They may be invoked in a [type expression], [item] position (except
as a [statement]), including items in [`extern` blocks], inherent and trait
[implementations], and [trait definitions]. They cannot be used in a
[statement], [expression], or [pattern]. These macros cannot expand to syntax
that defines new [`macro_rules`] style macros.
[items], including [`macro_rules`] definitions. They may be invoked in a [type
expression], [item] position (except as a [statement]), including items in
[`extern` blocks], inherent and trait [implementations], and [trait
definitions]. They cannot be used in a [statement], [expression], or
[pattern].

### Derive macros

Expand Down Expand Up @@ -202,8 +202,7 @@ tree following the attribute's name, not including the outer delimiters. If
the attribute is written as a bare attribute name, the attribute
[`TokenStream`] is empty. The second [`TokenStream`] is the rest of the [item]
including other [attributes] on the [item]. The returned [`TokenStream`]
replaces the [item] with an arbitrary number of [items]. These macros cannot
expand to syntax that defines new [`macro_rules`] style macros.
replaces the [item] with an arbitrary number of [items].

For example, this attribute macro takes the input stream and returns it as is,
effectively being the no-op of attributes.
Expand Down