mirror of https://github.com/rust-lang/rust.git
address review
This commit is contained in:
parent
e1e755311a
commit
5a9af37370
|
@ -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> {
|
||||||
|
|
Loading…
Reference in New Issue