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

Add a paragraph about slice patterns #259

Closed
wants to merge 1 commit into from

Conversation

petrochenkov
Copy link
Contributor

Necessary for stabilization (rust-lang/rust#48516).

@Havvy Havvy added the S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository label Mar 8, 2018
bors added a commit to rust-lang/rust that referenced this pull request Mar 20, 2018
Stabilize slice patterns without `..`

And merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`.

The detailed description can be found in #48836.

Slice patterns were unstable for long time since before 1.0 due to many bugs in the implementation, now this stabilization is possible primarily due to work of @arielb1 who [wrote the new MIR-based implementation of slice patterns](#32202) and @mikhail-m1 who [fixed one remaining class of codegen issues](#47926).

Reference PR rust-lang/reference#259
cc #23121
fixes #48836
@petrochenkov
Copy link
Contributor Author

rust-lang/rust#48516 has landed

@Mark-Simulacrum
Copy link
Member

Just reran travis, looks like there's a failing test:

---- /tmp/mdbook.ZnbEs7ZLN9cL/expressions/match-expr.md - match (line 144) stdout ----
	error[E0308]: mismatched types
 --> /tmp/mdbook.ZnbEs7ZLN9cL/expressions/match-expr.md:147:1
  |
2 |   fn main() {
  |             - expected `()` because of default return type
...
5 | / match arr {
6 | |     [1, _, _] => "starts with one",
7 | |     [a, b, c] => "starts with something else",
8 | | }
  | | ^- help: try adding a semicolon: `;`
  | |_|
  |   expected (), found &str
  |
  = note: expected type `()`
             found type `&str`

@steveklabnik
Copy link
Member

I fixed the failing test and merged in as b26c4b6

@petrochenkov petrochenkov deleted the slicepat branch June 5, 2019 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants