Skip to content

Commit a88f9ac

Browse files
paulstansifergraydon
authored andcommitted
Macros can now also be stmts and items.
1 parent f6a8ffc commit a88f9ac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/rust.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']'
494494

495495
User-defined syntax extensions are called "macros", and they can be defined
496496
with the `macro_rules!` syntax extension. User-defined macros can currently
497-
only be invoked in expression position.
497+
be invoked as expressions, statements, or items.
498498

499499
(A `sep_token` is any token other than `*` and `+`. A `non_special_token` is
500500
any token other than a delimiter or `$`.)
@@ -510,7 +510,7 @@ For parsing reasons, delimiters must be balanced, but they are otherwise not spe
510510

511511
In the matcher, `$` _name_ `:` _designator_ matches the nonterminal in the
512512
Rust syntax named by _designator_. Valid designators are `item`, `block`,
513-
`stmt`, `pat`, `expr`, `ty` (type), `ident`, `path`, `matchers` (lhs of the `=>` in macro rules),
513+
`stmt`, `pat`, `expr`, `ty` (type), `ident`, `path`, `matchers` (lhs of the `=>` in macro rules),
514514
`tt` (rhs of the `=>` in macro rules). In the transcriber, the designator is already known, and so only
515515
the name of a matched nonterminal comes after the dollar sign.
516516

@@ -2196,7 +2196,7 @@ Records and structures can also be pattern-matched and their fields bound to var
21962196
When matching fields of a record,
21972197
the fields being matched are specified first,
21982198
then a placeholder (`_`) represents the remaining fields.
2199-
2199+
22002200
~~~~
22012201
# type options = {choose: bool, size: ~str};
22022202
# type player = {player: ~str, stats: (), options: options};
@@ -2726,7 +2726,7 @@ The kinds are:
27262726
structural types containing only other sendable types.
27272727
`Owned`
27282728
: Types of this kind do not contain any borrowed pointers;
2729-
this can be a useful guarantee for code that breaks borrowing assumptions using [`unsafe` operations](#unsafe-functions).
2729+
this can be a useful guarantee for code that breaks borrowing assumptions using [`unsafe` operations](#unsafe-functions).
27302730
`Copy`
27312731
: This kind includes all types that can be copied. All types with
27322732
sendable kind are copyable, as are managed boxes, managed closures,

0 commit comments

Comments
 (0)