Skip to content

Commit e78a93c

Browse files
authored
Merge pull request #3800 from pitaj/patch-1
Fix misleading explanation of comma in `$(),*`
2 parents b195aeb + fa7e1c3 commit e78a93c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ch20-06-macros.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ for use in the replacement code. Within `$()` is `$x:expr`, which matches any
118118
Rust expression and gives the expression the name `$x`.
119119

120120
The comma following `$()` indicates that a literal comma separator character
121-
could optionally appear after the code that matches the code in `$()`. The `*`
122-
specifies that the pattern matches zero or more of whatever precedes the `*`.
121+
must appear between each instance of the code that matches the code within
122+
`$()`. The `*` specifies that the pattern matches zero or more of whatever
123+
precedes the `*`.
123124

124125
When we call this macro with `vec![1, 2, 3];`, the `$x` pattern matches three
125126
times with the three expressions `1`, `2`, and `3`.

0 commit comments

Comments
 (0)