Open
Description
fn fails_1(x: [String; 3], y: usize) {
let q: String = x[y];
//~^ ERROR cannot move out of type `[String; 3]`, a non-copy array
}
fn works_1(x: [String; 3], y: usize) {
let _: String = x[y];
}
fn fails_2(x: [String; 3]) {
let q: String = x[1];
//~^ ERROR cannot move out of type `[String; 3]`, a non-copy array
}
fn works_2(x: [String; 3]) {
let [_, q, _] = x;
let [a, _, b] = x;
}
Metadata
Metadata
Assignees
Labels
No labels