1 A value was moved out of a non-copy fixed-size array.
3 Erroneous code example:
9 let array = [NonCopy; 1];
10 let _value = array[0]; // error: cannot move out of type `[NonCopy; 1]`,
11 // a non-copy fixed-size array
15 The first element was moved out of the array, but this is not
16 possible because `NonCopy` does not implement the `Copy` trait.
18 Consider borrowing the element instead of moving it:
24 let array = [NonCopy; 1];
25 let _value = &array[0]; // Borrowing is allowed, unlike moving.
29 Alternatively, if your type implements `Clone` and you need to own the value,
30 consider borrowing and then cloning:
37 let array = [NonCopy; 1];
38 // Now you can clone the array element.
39 let _value = array[0].clone();
43 If you really want to move the value out, you can use a destructuring array
50 let array = [NonCopy; 1];
51 // Destructuring the array