]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/move-into-dead-array-2.rs
Rollup merge of #106446 - bzEq:fix-unwind-lsda, r=Amanieu
[rust.git] / tests / ui / moves / move-into-dead-array-2.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([d(), d(), d(), d()], 1);
9     foo([d(), d(), d(), d()], 3);
10 }
11
12 fn foo(mut a: [D; 4], i: usize) {
13     drop(a);
14     a[i] = d(); //~ ERROR use of moved value: `a`
15 }