@@ -3980,6 +3980,39 @@ impl SpaceLlama for i32 {
3980
3980
```
3981
3981
"## ,
3982
3982
3983
+ E0527 : r##"
3984
+ The number of elements in an array or slice pattern differed from the number of
3985
+ elements in the array being matched.
3986
+
3987
+ Example of erroneous code:
3988
+
3989
+ ```compile_fail,E0527
3990
+ #![feature(slice_patterns)]
3991
+
3992
+ let r = &[1, 2, 3, 4];
3993
+ match r {
3994
+ &[a, b] => { // error: pattern requires 2 elements but array
3995
+ // has 4
3996
+ println!("a={}, b={}", a, b);
3997
+ }
3998
+ }
3999
+ ```
4000
+
4001
+ Ensure that the pattern is consistent with the size of the matched
4002
+ array. Additional elements can be matched with `..`:
4003
+
4004
+ ```
4005
+ #![feature(slice_patterns)]
4006
+
4007
+ let r = &[1, 2, 3, 4];
4008
+ match r {
4009
+ &[a, b, ..] => { // ok!
4010
+ println!("a={}, b={}", a, b);
4011
+ }
4012
+ }
4013
+ ```
4014
+ "## ,
4015
+
3983
4016
E0529 : r##"
3984
4017
An array or slice pattern was matched against some other type.
3985
4018
@@ -4131,7 +4164,6 @@ register_diagnostics! {
4131
4164
E0436 , // functional record update requires a struct
4132
4165
E0513 , // no type for local variable ..
4133
4166
E0521 , // redundant default implementations of trait
4134
- E0527 , // expected {} elements, found {}
4135
4167
E0528 , // expected at least {} elements, found {}
4136
4168
E0533 , // `{}` does not name a unit variant, unit struct or a constant
4137
4169
}
0 commit comments