Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
  • Loading branch information
b-naber committed Jul 28, 2023
1 parent e1e7553 commit 5a9af37
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/ui/pattern/slice-patterns-irrefutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn array_try_from(x: &[usize]) -> Result<usize, TryFromSliceError> {
Ok(a + b)
}

fn default() {
fn destructuring_assignment() {
let a: i32;
let b;
[a, b] = Default::default();
Expand All @@ -45,6 +45,18 @@ fn test_nested_array() {
[a, b] = Default::default();
}

fn test_nested_array_type_hint() {
let a: [_; 3];
let b;
[a, b] = Default::default();
let _: i32 = b[1];
}

fn test_working_nested_array() {
let a: i32;
[[a, _, _], _, _] = Default::default();
}

struct Foo<T>([T; 2]);

impl<T: Default + Copy> Default for Foo<T> {
Expand Down

0 comments on commit 5a9af37

Please sign in to comment.