Skip to content

Commit 035f4cc

Browse files
committed
Auto merge of #31240 - durka:follow-set-docs, r=pnkfelix
Missed as part of #31152, but the list had other mistakes as well. r? @pnkfelix
2 parents 1c06f64 + fd4d013 commit 035f4cc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/doc/book/macros.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ which syntactic form it matches.
478478

479479
There are additional rules regarding the next token after a metavariable:
480480

481-
* `expr` variables may only be followed by one of: `=> , ;`
482-
* `ty` and `path` variables may only be followed by one of: `=> , : = > as`
483-
* `pat` variables may only be followed by one of: `=> , = if in`
481+
* `expr` and `stmt` variables may only be followed by one of: `=> , ;`
482+
* `ty` and `path` variables may only be followed by one of: `=> , = | ; : > [ { as where`
483+
* `pat` variables may only be followed by one of: `=> , = | if in`
484484
* Other variables may be followed by any token.
485485

486486
These rules provide some flexibility for Rust’s syntax to evolve without

src/libsyntax/ext/tt/macro_rules.rs

+1
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ fn can_be_followed_by_any(frag: &str) -> bool {
972972
/// we expanded `expr` to include a new binary operator, we might
973973
/// break macros that were relying on that binary operator as a
974974
/// separator.
975+
// when changing this do not forget to update doc/book/macros.md!
975976
fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> {
976977
if let &CloseDelim(_) = tok {
977978
// closing a token tree can never be matched by any fragment;

0 commit comments

Comments
 (0)