Skip to content

extended information for slice pattern errors (E0527 through E0529) #34319

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

Merged
merged 3 commits into from
Aug 5, 2016
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
Next Next commit
add extended information for E0529, slice pattern expects array or slice
  • Loading branch information
zackmdavis committed Jul 31, 2016
commit 65e3ff4df44effdfa60971cd7b66e4ce8a4c5bb9
32 changes: 31 additions & 1 deletion src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3980,6 +3980,37 @@ impl SpaceLlama for i32 {
```
"##,

E0529: r##"
An array or slice pattern was matched against some other type.

Example of erroneous code:

```compile_fail,E0529
#![feature(slice_patterns)]

let r: f32 = 1.0;
match r {
[a, b] => { // error: expected an array or slice, found `f32`
println!("a={}, b={}", a, b);
}
}
```

Ensure that the pattern and the expression being matched on are of consistent
types:

```
#![feature(slice_patterns)]

let r = [1.0, 2.0];
match r {
[a, b] => { // ok!
println!("a={}, b={}", a, b);
}
}
```
"##,

E0559: r##"
An unknown field was specified into an enum's structure variant.

Expand Down Expand Up @@ -4102,6 +4133,5 @@ register_diagnostics! {
E0521, // redundant default implementations of trait
E0527, // expected {} elements, found {}
E0528, // expected at least {} elements, found {}
E0529, // slice pattern expects array or slice, not `{}`
E0533, // `{}` does not name a unit variant, unit struct or a constant
}