Closed
Description
fn main() {
let split = [~1, ~2];
match split {
[] => die!(),
[_head, ..tail] => tail
};
}
I'm not 100% sure if this should be legal, but the error message it gives is baffling:
$ rustc split2.rs
split2.rs:4:10: 4:15 error: moving out of immutable local variable prohibited due to outstanding loan
split2.rs:4 match split {
^~~~~
split2.rs:4:10: 4:15 note: loan of immutable local variable granted here
split2.rs:4 match split {
^~~~~
error: aborting due to previous error
Note that the error only occurs if you create a head
binding. Replacing _head
with _
causes this error to go away.
Metadata
Metadata
Assignees
Labels
No labels