I fail to understand what the problem in the following code is supposed to be:
extern crate rand;
use rand::*;
#[derive(Debug)]
enum Foo {
    A,
    B,
}
static FOOS: [Foo; 2] = [Foo::A, Foo::B];
fn random_foo() -> Foo {
    let i = rand::thread_rng().gen_range(0, FOOS.len());
    FOOS[i]
}
fn main() {
    println!(
        "First: {:?} Second: {:?} Random: {:?}",
        FOOS[0],
        FOOS[1],
        random_foo()
    );
}
I get the error:
error[E0508]: cannot move out of type `[Foo; 2]`, a non-copy array
  --> src/main.rs:14:5
   |
14 |     FOOS[i]
   |     ^^^^^^^ cannot move out of here
Using only the first 2 parts of the println!() and removing fn random_foo(), the code compiles. I cannot see what random_foo() does differently which is worth a compiler error. It only accesses an element of FOOS and tries to return the value, just like the arguments in the print statement in main() do.