Skip to content

Commit

Permalink
Rollup merge of rust-lang#30406 - durka:patch-13, r=sanxiyn
Browse files Browse the repository at this point in the history
The previous example had no chance of compiling in either form, due to the restrictive follow set for `ty`. This one has the desired behavior: http://is.gd/kYdw4g (well, I don't exactly desire this behavior at all, but it's true at least :p )
  • Loading branch information
Manishearth committed Dec 18, 2015
2 parents 7eb7bc2 + d91b256 commit 158a1bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/doc/book/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,10 @@ These rules provide some flexibility for Rust’s syntax to evolve without
breaking existing macros.

The macro system does not deal with parse ambiguity at all. For example, the
grammar `$($t:ty)* $e:expr` will always fail to parse, because the parser would
be forced to choose between parsing `$t` and parsing `$e`. Changing the
grammar `$($i:ident)* $e:expr` will always fail to parse, because the parser would
be forced to choose between parsing `$i` and parsing `$e`. Changing the
invocation syntax to put a distinctive token in front can solve the problem. In
this case, you can write `$(T $t:ty)* E $e:exp`.
this case, you can write `$(I $i:ident)* E $e:expr`.

[item]: ../reference.html#items

Expand Down

0 comments on commit 158a1bd

Please sign in to comment.