Skip to content

Commit

Permalink
renew metavar-and-expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
zjp-CN committed Apr 19, 2022
1 parent 7d9b339 commit b4c4320
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/decl-macros/minutiae/metavar-and-expansion.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ fn main() {
在 Rust 1.52 中,能够紧跟片段分类符后面的内容具有如下限制[^Follow-set Ambiguity Restrictions]

* [`stmt`][`expr`]`=>``,``;` 之一
* [`pat`]`=>``,``=``|``if``in` 之一
* [`pat`]`=>``,``=``if``in` 之一[^pat-edition]
* [`pat_param`]`=>``,``=``|``if``in` 之一
* [`path`][`ty`]`=>``,``=``|``;``:``>``>>``[``{``as``where` 之一;
或者 [`block`] 型的元变量
* [`vis`]`,`、除了 `priv` 之外的标识符、任何以类型开头的标记、
[`ident`][`ty`][`path`] 型的元变量
* 其他片段分类符所跟的内容无限制

[^pat-edition]: 使用 2021 edition 之前的 Rust,`pat` 依然可以跟随 `|`

反复匹配的情况也遵循这些限制[^Follow-set Ambiguity Restrictions],也就是说:

1. 如果一个重复操作符(`*``+`)能让一类元变量重复数次,
Expand Down

0 comments on commit b4c4320

Please sign in to comment.