You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.