Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue for `#![feature(slice_patterns)]` #62254

Open
Centril opened this issue Jun 30, 2019 · 8 comments

Comments

@Centril
Copy link
Member

@Centril Centril commented Jun 30, 2019

This is a tracking issue for the feature gate #![feature(slice_patterns)] covering the following RFCs:

For the old tracking issue see #23121.

Steps:

Unresolved questions:

None thus far.

Centril added a commit to Centril/rust that referenced this issue Jul 1, 2019
…, r=varkor

Switch tracking issue for `#![feature(slice_patterns)]`

Switches the tracking issue for `#![feature(slice_patterns)]` to a fresh one in rust-lang#62254 due to new RFCs.

Closes rust-lang#23121.

r? @varkor
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 3, 2019
…, r=varkor

Switch tracking issue for `#![feature(slice_patterns)]`

Switches the tracking issue for `#![feature(slice_patterns)]` to a fresh one in rust-lang#62254 due to new RFCs.

Closes rust-lang#23121.

r? @varkor
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 3, 2019
…, r=varkor

Switch tracking issue for `#![feature(slice_patterns)]`

Switches the tracking issue for `#![feature(slice_patterns)]` to a fresh one in rust-lang#62254 due to new RFCs.

Closes rust-lang#23121.

r? @varkor
@Centril Centril self-assigned this Jul 6, 2019
@Centril

This comment has been minimized.

Copy link
Member Author

@Centril Centril commented Jul 6, 2019

For now, I'm working on the syntactic aspect of supporting .. as a valid pattern syntactic pattern.

Centril added a commit to Centril/rust that referenced this issue Jul 26, 2019
Implement RFC 2707 + Parser recovery for range patterns

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 rust-lang#62254

r? @petrochenkov
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 27, 2019
Implement RFC 2707 + Parser recovery for range patterns

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 rust-lang#62254

r? @petrochenkov
bors added a commit that referenced this issue Jul 27, 2019
Implement RFC 2707 + Parser recovery for range patterns

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
Centril added a commit to Centril/rust that referenced this issue Jul 28, 2019
Implement RFC 2707 + Parser recovery for range patterns

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 rust-lang#62254

r? @petrochenkov
Centril added a commit to Centril/rust that referenced this issue Jul 28, 2019
Implement RFC 2707 + Parser recovery for range patterns

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 rust-lang#62254

r? @petrochenkov
@Centril

This comment has been minimized.

Copy link
Member Author

@Centril Centril commented Jul 28, 2019

The syntax change in rust-lang/rfcs#2707 was implemented on the 2019-07-28 in #62550 (author: @Centril, reviewer: @petrochenkov).

What remains now is:

  • Adding more tests for the syntax. #63111

  • Verifying the semantics in terms of type checking and making changes as needed. #63129

Before / during stabilization, we must also:

  • Organize the tests.
Centril added a commit to Centril/rust that referenced this issue Jul 30, 2019
Add syntactic and semantic tests for rest patterns, i.e. `..`

As per my first note in rust-lang#62254 (comment) this adds syntactic and semantic tests for `..` ("rest") patterns which were implemented in rust-lang#62550.

r? @estebank
@Centril

This comment has been minimized.

Copy link
Member Author

@Centril Centril commented Jul 30, 2019

  • One remaining issue is also #53820.
    cc @RalfJung and @varkor re. ^-- Not sure whether that's blocking or not.
@RalfJung

This comment has been minimized.

Copy link
Member

@RalfJung RalfJung commented Jul 30, 2019

Not sure either. Someone will have to make the call if it is okay for matching on big arrays to stack-overflow.

Last time I checked, on Windows, matching on [0u8; 1024] is actually enough to trigger the error.

Centril added a commit to Centril/rust that referenced this issue Jul 30, 2019
…-obk

Subslice patterns: Test passing static & dynamic semantics.

Working towards testing coverage for rust-lang#62254.
See https://github.com/rust-lang/rfcs/blob/master/text/2359-subslice-pattern-syntax.md for the RFC.

r? @oli-obk cc @petrochenkov
Centril added a commit to Centril/rust that referenced this issue Jul 30, 2019
…-obk

Subslice patterns: Test passing static & dynamic semantics.

Working towards testing coverage for rust-lang#62254.
See https://github.com/rust-lang/rfcs/blob/master/text/2359-subslice-pattern-syntax.md for the RFC.

r? @oli-obk cc @petrochenkov
@Centril

This comment has been minimized.

Copy link
Member Author

@Centril Centril commented Jul 31, 2019

#63111 and #63129 have both landed. In combination previously existing tests I believe we can be confident in the implementation now. The only remaining issue is #53820 now.

@estebank

This comment has been minimized.

Copy link
Contributor

@estebank estebank commented Jul 31, 2019

@Centril would having an arbitrary size limit in arrays used in patterns help with masking #53820 to stabilize earlier?

@Centril

This comment has been minimized.

Copy link
Member Author

@Centril Centril commented Jul 31, 2019

@estebank Seems like bad policy to encode such arbitrary limits in the language itself? At minimum I want to know why it is the case that #53820 happens and whether it is fundamental or a bug that we can fix soon-ish.

@varkor

This comment has been minimized.

Copy link
Member

@varkor varkor commented Oct 7, 2019

When this is stable, we should suggest using tail @ .. rather than ..tail, e.g. in:

fn foo(x: &[u32]) {
    match x {
        [..tail] => {} // error
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.