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

RFC: Finalize syntax for slice patterns with subslices #2359

Merged
merged 8 commits into from
Jun 30, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some copy-paste errors
  • Loading branch information
petrochenkov committed Jun 8, 2019
commit b9e08206dad173acb63d1b4b658b31cb18fd6e64
6 changes: 3 additions & 3 deletions text/0000-subslice-pattern-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@ match v {
[1, subarray @ .., 3] => assert_eq!(subarray, [2]), // typeof(subarray) == [i32; 1]
[5, subarray @ ..] => has_type::<[i32; 2]>(subarray), // typeof(subarray) == [i32; 2]
[subarray @ .., 6] => has_type::<[i32, 2]>(subarray), // typeof(subarray) == [i32; 2]
[x, .., y] => has_type::<[i32, 1]>(x), // typeof(subarray) == [i32; 1]
[x, .., y] => has_type::<i32>(x),
[..] => {},
}
match v {
[1, ref subarray @ .., 3] => assert_eq!(subarray, [2]), // typeof(subarray) == &[i32; 1]
[5, ref subarray @ ..] => has_type::<&[i32; 2]>(subarray), // typeof(subarray) == &[i32; 2]
[ref subarray @ .., 6] => has_type::<&[i32, 2]>(subarray), // typeof(subarray) == &[i32; 2]
[x, .., y] => has_type::<&[i32, 1]>(x), // typeof(subarray) == &[i32; 1]
[x, .., y] => has_type::<&i32>(x),
[..] => {},
}
match &mut v {
[1, subarray @ .., 3] => assert_eq!(subarray, [2]), // typeof(subarray) == &mut [i32; 1]
[5, subarray @ ..] => has_type::<&mut [i32; 2]>(subarray), // typeof(subarray) == &mut [i32; 2]
[subarray @ .., 6] => has_type::<&mut [i32, 2]>(subarray), // typeof(subarray) == &mut [i32; 2]
[x, .., y] => has_type::<&mut [i32, 1]>(x), // typeof(subarray) == &mut [i32; 1]
[x, .., y] => has_type::<&mut i32>(x),
[..] => {},
}
```
petrochenkov marked this conversation as resolved.
Show resolved Hide resolved
Expand Down