Skip to content

Commit 7807787

Browse files
committed
RFC 1492: .. in patterns
1 parent eb75036 commit 7807787

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

text/0000-dotdot-in-patterns.md renamed to text/1492-dotdot-in-patterns.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- Feature Name: dotdot_in_patterns
22
- Start Date: 2016-02-06
3-
- RFC PR: (leave this empty)
3+
- RFC PR: https://github.com/rust-lang/rfcs/pull/1492
44
- Rust Issue: (leave this empty)
55

66
# Summary
@@ -69,6 +69,7 @@ S { subpat1, subpat2, .. }
6969
// anywhere except for one conventionally chosen position (the last one) or in sublist bindings,
7070
// so we don't propose extensions to struct patterns.
7171
S { subpat1, .., subpatN }
72+
// **NOT PROPOSED**: Struct patterns with bindings
7273
S { subpat1, binding.., subpatN }
7374
7475
// Tuple struct patterns, the last and the only position, no extra subpatterns allowed.
@@ -77,22 +78,20 @@ S(..)
7778
S(subpat1, subpat2, ..)
7879
S(.., subpatN-1, subpatN)
7980
S(subpat1, .., subpatN)
80-
// **NEW**: Tuple struct patterns, any position with a sublist binding.
81-
// The binding has a tuple type.
82-
// By ref bindings are not allowed, because layouts of S(A, B, C, D) and (B, C) are not necessarily
83-
// compatible (e.g. field reordering is possible).
81+
// **NOT PROPOSED**: Struct patterns with bindings
8482
S(subpat1, binding.., subpatN)
8583
8684
// **NEW**: Tuple patterns, any position.
8785
(subpat1, subpat2, ..)
8886
(.., subpatN-1, subpatN)
8987
(subpat1, .., subpatN)
90-
// **NEW**: Tuple patterns, any position with a sublist binding.
91-
// The binding has a tuple type.
92-
// By ref bindings are not allowed, because layouts of (A, B, C, D) and (B, C) are not necessarily
93-
// compatible (e.g. field reordering is possible).
88+
// **NOT PROPOSED**: Tuple patterns with bindings
9489
(subpat1, binding.., subpatN)
90+
```
91+
92+
Slice patterns are not covered in this RFC, but here is the syntax for reference:
9593

94+
```
9695
// Slice patterns, the last position.
9796
[subpat1, subpat2, ..]
9897
// Slice patterns, the first position.

0 commit comments

Comments
 (0)