Add regression test for #92069

This commit is contained in:
est31 2022-02-21 04:45:40 +01:00
parent e7730dcb7e
commit 5bd71063b3
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,9 @@
// issue #92069
#![feature(let_else)]
fn main() {
let nums = vec![5, 4, 3, 2, 1];
let [x, y] = nums else { //~ ERROR expected an array or slice
return;
};
}

View file

@ -0,0 +1,11 @@
error[E0529]: expected an array or slice, found `Vec<{integer}>`
--> $DIR/let-else-slicing-error.rs:6:9
|
LL | let [x, y] = nums else {
| ^^^^^^ ---- help: consider slicing here: `nums[..]`
| |
| pattern cannot match with input type `Vec<{integer}>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0529`.