]> git.lizzy.rs Git - rust.git/blob - src/test/ui/moves/move-into-dead-array-1.rs
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / moves / move-into-dead-array-1.rs
1 // Ensure that we cannot move into an uninitialized fixed-size array.
2
3 struct D { _x: u8 }
4
5 fn d() -> D { D { _x: 0 } }
6
7 fn main() {
8     foo(1);
9     foo(3);
10 }
11
12 fn foo(i: usize) {
13     let mut a: [D; 4];
14     a[i] = d();        //~ ERROR use of possibly uninitialized variable: `a`
15 }