Closed
Description
I have some code that looks like
let mut map : LinearMap<~[u8], int> = LinearMap::new();
for split_vec(text, 16).each |&block| {
match map.find_mut(&block) {
None => { map.insert(block, 0); }
Some(x) => { *x += 1; }
}
}
(split_vec
returns a ~[~[T]]
)
Unfortunately the compiler complains about
foo.rc:46:13: 46:16 error: loan of mutable local variable as mutable conflicts with prior loan
foo.rc:46 None => { map.insert(block, 0); }
^~~
foo.rc:45:8: 45:11 note: prior loan as mutable granted here
foo.rc:45 match map.find_mut(&block) {
^~~
I can't figure out why calling two methods that both take &mut self
is a problem here.
Metadata
Metadata
Assignees
Labels
No labels