We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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]])
split_vec
~[~[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.
&mut self
The text was updated successfully, but these errors were encountered:
The only way I could figure out how to accomplish what I wanted was to stuff the map into a @mut box. Surely that shouldn't be necessary.
@mut
Sorry, something went wrong.
this is due to the lack of flow-sensitivity in the borrow checker. hopefully this will be fixed soon. dup of #5074
Merge pull request rust-lang#5982 from flip1995/backport
12b8c64
[beta] Backport: Re-enable len_zero for ranges now that `is_empty` is stable on them
No branches or pull requests
I have some code that looks like
(
split_vec
returns a~[~[T]]
)Unfortunately the compiler complains about
I can't figure out why calling two methods that both take
&mut self
is a problem here.The text was updated successfully, but these errors were encountered: