Skip to content

Commit d91b256

Browse files
committed
change macro ambiguity example from ty to ident
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 )
1 parent 9e63cec commit d91b256

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/book/macros.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,10 @@ These rules provide some flexibility for Rust’s syntax to evolve without
485485
breaking existing macros.
486486

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

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

0 commit comments

Comments
 (0)