mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
trpl: fix macro follow sets
This commit is contained in:
parent
8256c470a5
commit
fd4d013a2c
@ -478,9 +478,9 @@ which syntactic form it matches.
|
|||||||
|
|
||||||
There are additional rules regarding the next token after a metavariable:
|
There are additional rules regarding the next token after a metavariable:
|
||||||
|
|
||||||
* `expr` variables may only be followed by one of: `=> , ;`
|
* `expr` and `stmt` variables may only be followed by one of: `=> , ;`
|
||||||
* `ty` and `path` variables may only be followed by one of: `=> , : = > as`
|
* `ty` and `path` variables may only be followed by one of: `=> , = | ; : > [ { as where`
|
||||||
* `pat` variables may only be followed by one of: `=> , = if in`
|
* `pat` variables may only be followed by one of: `=> , = | if in`
|
||||||
* Other variables may be followed by any token.
|
* Other variables may be followed by any token.
|
||||||
|
|
||||||
These rules provide some flexibility for Rust’s syntax to evolve without
|
These rules provide some flexibility for Rust’s syntax to evolve without
|
||||||
|
@ -972,6 +972,7 @@ fn can_be_followed_by_any(frag: &str) -> bool {
|
|||||||
/// we expanded `expr` to include a new binary operator, we might
|
/// we expanded `expr` to include a new binary operator, we might
|
||||||
/// break macros that were relying on that binary operator as a
|
/// break macros that were relying on that binary operator as a
|
||||||
/// separator.
|
/// separator.
|
||||||
|
// when changing this do not forget to update doc/book/macros.md!
|
||||||
fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> {
|
fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> {
|
||||||
if let &CloseDelim(_) = tok {
|
if let &CloseDelim(_) = tok {
|
||||||
// closing a token tree can never be matched by any fragment;
|
// closing a token tree can never be matched by any fragment;
|
||||||
|
Loading…
Reference in New Issue
Block a user