address review

This commit is contained in:
b-naber 2023-07-28 11:20:11 +00:00
parent e1e755311a
commit 5a9af37370
1 changed files with 13 additions and 1 deletions

View File

@ -32,7 +32,7 @@ fn array_try_from(x: &[usize]) -> Result<usize, TryFromSliceError> {
Ok(a + b) Ok(a + b)
} }
fn default() { fn destructuring_assignment() {
let a: i32; let a: i32;
let b; let b;
[a, b] = Default::default(); [a, b] = Default::default();
@ -45,6 +45,18 @@ fn test_nested_array() {
[a, b] = Default::default(); [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]); struct Foo<T>([T; 2]);
impl<T: Default + Copy> Default for Foo<T> { impl<T: Default + Copy> Default for Foo<T> {