Add match on Vec<_>
to ui/typeck/issue-91328.rs
test
This commit is contained in:
parent
c15ef58f4f
commit
0363f11ff0
@ -24,4 +24,14 @@ fn bar(o: Option<Vec<i32>>) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
fn baz(v: Vec<i32>) -> i32 {
|
||||
match v[..] {
|
||||
//~^ HELP: consider slicing here
|
||||
[a, b] => a + b,
|
||||
//~^ ERROR: expected an array or slice
|
||||
//~| NOTE: pattern cannot match with input type
|
||||
_ => 42,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -24,4 +24,14 @@ fn bar(o: Option<Vec<i32>>) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
fn baz(v: Vec<i32>) -> i32 {
|
||||
match v {
|
||||
//~^ HELP: consider slicing here
|
||||
[a, b] => a + b,
|
||||
//~^ ERROR: expected an array or slice
|
||||
//~| NOTE: pattern cannot match with input type
|
||||
_ => 42,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -16,6 +16,15 @@ LL |
|
||||
LL | Some([a, b]) => a + b,
|
||||
| ^^^^^^ pattern cannot match with input type `Vec<i32>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0529]: expected an array or slice, found `Vec<i32>`
|
||||
--> $DIR/issue-91328.rs:30:9
|
||||
|
|
||||
LL | match v {
|
||||
| - help: consider slicing here: `v[..]`
|
||||
LL |
|
||||
LL | [a, b] => a + b,
|
||||
| ^^^^^^ pattern cannot match with input type `Vec<i32>`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0529`.
|
||||
|
Loading…
Reference in New Issue
Block a user