Skip to content

Implement RFC 2707 + Parser recovery for range patterns#62550

Merged
bors merged 34 commits intorust-lang:masterfrom
Centril:rest-patterns
Jul 28, 2019
Merged

Implement RFC 2707 + Parser recovery for range patterns#62550
bors merged 34 commits intorust-lang:masterfrom
Centril:rest-patterns

Conversation

@Centril
Copy link
Copy Markdown
Contributor

@Centril Centril commented Jul 10, 2019

Implement rust-lang/rfcs#2707.

  • Add a new basic syntactic pattern form ast::PatKind::Rest (parsed as .. or DOTDOT) and simplify ast::PatKind::{Slice, Tuple, TupleStruct} as a result.

  • Lower ast::PatKind::Rest in combination with the aforementioned PatKind variants as well as PatKind::Ident. The HIR remains unchanged for now (may be advisable to make slight adjustments later).

  • Refactor parser.rs wrt. parsing sequences and lists of things in the process.

  • Add parser recovery for range patterns of form X.., X..=, X..., ..Y, ..=Y, and ...Y.
    This should make it easy to actually support these patterns semantically later if we so desire.

cc #62254

r? @petrochenkov

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-exclusive_range_pattern `#![feature(exclusive_range_pattern)]` F-half_open_range_patterns `#![feature(half_open_range_patterns)]` F-slice_patterns `#![feature(slice_patterns)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants