Skip to content

Commit

Permalink
Add regression test for rust-lang#92069
Browse files Browse the repository at this point in the history
  • Loading branch information
est31 committed Feb 21, 2022
1 parent e7730dc commit 5bd7106
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/ui/let-else/let-else-slicing-error.rs
Original file line number Diff line number Diff line change
@@ -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;
};
}
11 changes: 11 additions & 0 deletions src/test/ui/let-else/let-else-slicing-error.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 5bd7106

Please sign in to comment.