diff options
author | Aleksey Kladov <[email protected]> | 2020-04-03 14:38:42 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-03 15:12:38 +0100 |
commit | da8eb29a2f70a58122903bf087bd6c1d0fbd6d3f (patch) | |
tree | ac21306c7bf9dc816f4b0e9b50322f57256eddfa /xtask | |
parent | 0e46ed8420469741d718ac223fad1088c151b497 (diff) |
Macro patterns are not confused with expressions.
We treat macro calls as expressions (there's appropriate Into impl),
which causes problem if there's expresison and non-expression macro in
the same node (like in the match arm).
We fix this problem by nesting macor patterns into another node (the
same way we nest path into PathExpr or PathPat). Ideally, we probably
should add a similar nesting for macro expressions, but that needs
some careful thinking about macros in blocks: `{ am_i_expression!() }`.
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/src/ast_src.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 99bd60198..d9f51ec39 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -138,6 +138,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
138 | "SLICE_PAT", | 138 | "SLICE_PAT", |
139 | "RANGE_PAT", | 139 | "RANGE_PAT", |
140 | "LITERAL_PAT", | 140 | "LITERAL_PAT", |
141 | "MACRO_PAT", | ||
141 | // atoms | 142 | // atoms |
142 | "TUPLE_EXPR", | 143 | "TUPLE_EXPR", |
143 | "ARRAY_EXPR", | 144 | "ARRAY_EXPR", |
@@ -440,6 +441,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
440 | struct SlicePat { args: [Pat] } | 441 | struct SlicePat { args: [Pat] } |
441 | struct RangePat {} | 442 | struct RangePat {} |
442 | struct LiteralPat { Literal } | 443 | struct LiteralPat { Literal } |
444 | struct MacroPat { MacroCall } | ||
443 | 445 | ||
444 | struct RecordPat { RecordFieldPatList, Path } | 446 | struct RecordPat { RecordFieldPatList, Path } |
445 | struct RecordFieldPatList { | 447 | struct RecordFieldPatList { |
@@ -622,6 +624,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
622 | SlicePat, | 624 | SlicePat, |
623 | RangePat, | 625 | RangePat, |
624 | LiteralPat, | 626 | LiteralPat, |
627 | MacroPat, | ||
625 | } | 628 | } |
626 | 629 | ||
627 | enum AttrInput { Literal, TokenTree } | 630 | enum AttrInput { Literal, TokenTree } |