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
I was working on adding a find_or_insert function to the hashmaps, and I ran into some trouble with the lifetime borrow checker. Here's my distilled code:
test.rs:13:22: 13:33 error: assigning to mutable vec content prohibited due to outstanding loan
test.rs:13 None => { self.xs[key] = Some(Bucket { value: value }); }
^~~~~~~~~~~
test.rs:16:14: 16:25 note: loan of mutable vec content granted here
test.rs:16 match self.xs[key] {
^~~~~~~~~~~
error: aborting due to previous error
However, if instead I comment out find_or_insert1, it compiles fine. It would be great if there was a way to do this in one function, instead of needing a helper function work around lifetime issues.
The text was updated successfully, but these errors were encountered:
I was working on adding a
find_or_insert
function to the hashmaps, and I ran into some trouble with the lifetime borrow checker. Here's my distilled code:This errors with:
However, if instead I comment out
find_or_insert1
, it compiles fine. It would be great if there was a way to do this in one function, instead of needing a helper function work around lifetime issues.The text was updated successfully, but these errors were encountered: