diff options
| author | Paul Stansifer <paul.stansifer@gmail.com> | 2012-11-22 11:54:52 -0500 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-11-29 12:09:11 -0800 |
| commit | a88f9ac732e5674404103b7c975f0dba845d79a6 (patch) | |
| tree | b93e0ed4d11ea1fc759ad0c19b1c3bfdbbc161ee /doc | |
| parent | f6a8ffc625aec7865280e3dfc2d3bd822f072142 (diff) | |
Macros can now also be stmts and items.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/rust.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/rust.md b/doc/rust.md index d4e8a9e4691..0c8d1c5a140 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -494,7 +494,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']' User-defined syntax extensions are called "macros", and they can be defined with the `macro_rules!` syntax extension. User-defined macros can currently -only be invoked in expression position. +be invoked as expressions, statements, or items. (A `sep_token` is any token other than `*` and `+`. A `non_special_token` is any token other than a delimiter or `$`.) @@ -510,7 +510,7 @@ For parsing reasons, delimiters must be balanced, but they are otherwise not spe In the matcher, `$` _name_ `:` _designator_ matches the nonterminal in the Rust syntax named by _designator_. Valid designators are `item`, `block`, -`stmt`, `pat`, `expr`, `ty` (type), `ident`, `path`, `matchers` (lhs of the `=>` in macro rules), +`stmt`, `pat`, `expr`, `ty` (type), `ident`, `path`, `matchers` (lhs of the `=>` in macro rules), `tt` (rhs of the `=>` in macro rules). In the transcriber, the designator is already known, and so only the name of a matched nonterminal comes after the dollar sign. @@ -2196,7 +2196,7 @@ Records and structures can also be pattern-matched and their fields bound to var When matching fields of a record, the fields being matched are specified first, then a placeholder (`_`) represents the remaining fields. - + ~~~~ # type options = {choose: bool, size: ~str}; # type player = {player: ~str, stats: (), options: options}; @@ -2726,7 +2726,7 @@ The kinds are: structural types containing only other sendable types. `Owned` : Types of this kind do not contain any borrowed pointers; - this can be a useful guarantee for code that breaks borrowing assumptions using [`unsafe` operations](#unsafe-functions). + this can be a useful guarantee for code that breaks borrowing assumptions using [`unsafe` operations](#unsafe-functions). `Copy` : This kind includes all types that can be copied. All types with sendable kind are copyable, as are managed boxes, managed closures, |
