@@ -13,7 +13,7 @@ accepted:
13
13
``` rust
14
14
(a , (b . x. y, c )) = (0 , (1 , 2 ));
15
15
(x , y , .. , z ) = (1.0 , 2.0 , 3.0 , 4.0 , 5.0 );
16
- [_ , f , * baz ()] = foo ();
16
+ [_ , f , * baz (), a [ i ] ] = foo ();
17
17
[g , _ , h , .. ] = ['a' , 'w' , 'e' , 's' , 'o' , 'm' , 'e' , '!' ];
18
18
Struct { x : a , y : b } = bar ();
19
19
Struct { x , y } = Struct { x : 5 , y : 6 };
@@ -128,7 +128,7 @@ identifiers are fresh and thus do not conflict with existing variables). A nice
128
128
we inherit the diagnostics for normal pattern-matching, so users benefit from existing diagnostics
129
129
for destructuring declarations.
130
130
131
- Nested structures are destructured appropriately , for instance:
131
+ Nested structures may be destructured , for instance:
132
132
133
133
``` rust
134
134
let (a , b , c );
@@ -152,6 +152,11 @@ Note that `#[non_exhaustive]` must be taken into account properly: enums marked
152
152
may not have their variants destructured, and structs marked ` #[non_exhaustive] ` may only be
153
153
destructured using ` .. ` .
154
154
155
+ Patterns must be irrefutable. In particular, only slice patterns whose length is known at compile-
156
+ time, and the trivial slice ` [..] ` may be used for destructuring assignment.
157
+
158
+ As expected from the desugaring, the default binding modes of normal ` let ` destructuring applying.
159
+
155
160
## Diagnostics
156
161
157
162
It is worth being explicit that, in the implementation, the diagnostics that are reported are
0 commit comments