diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-26 23:55:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-26 23:55:44 +0200 |
| commit | 7dc3c934e85a12bd48abf749d52c4be69e7eed5b (patch) | |
| tree | 20000b371a3ae2118f2740f748f98645376479ab /src/libsyntax/parse/parser/module.rs | |
| parent | 44cfa7823d25ca52e42e23aad7dec22e4626f892 (diff) | |
| parent | 2bd27fbdfe309f3f6abd76f72f379247d49048b7 (diff) | |
| download | rust-7dc3c934e85a12bd48abf749d52c4be69e7eed5b.tar.gz rust-7dc3c934e85a12bd48abf749d52c4be69e7eed5b.zip | |
Rollup merge of #63693 - Centril:polish-parse-or-pats, r=estebank
Fully implement or-pattern parsing
Builds upon the initial parsing in https://github.com/rust-lang/rust/pull/61708 to fully implement or-pattern (`p | q`) parsing as specified in [the grammar section of RFC 2535](https://github.com/rust-lang/rfcs/blob/master/text/2535-or-patterns.md#grammar).
Noteworthy:
- We allow or-patterns in `[p | q, ...]`.
- We allow or-patterns in `let` statements and `for` expressions including with leading `|`.
- We improve recovery for `p || q` (+ tests for that in `multiple-pattern-typo.rs`).
- We improve recovery for `| p | q` in inner patterns (tests in `or-patterns-syntactic-fail.rs`).
- We rigorously test or-pattern parsing (in `or-patterns-syntactic-{pass,fail}.rs`).
- We harden the feature gating tests.
- We do **_not_** change `ast.rs`. That is, `ExprKind::Let.0` and `Arm.pats` still accept `Vec<P<Pat>>`.
I was starting work on that but it would be cleaner to do this in a separate PR so this one has a narrower scope.
cc @dlrobertson
cc the tracking issue https://github.com/rust-lang/rust/issues/54883.
r? @estebank
Diffstat (limited to 'src/libsyntax/parse/parser/module.rs')
0 files changed, 0 insertions, 0 deletions
