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
error[E0505]: cannot move out of `val` because it is borrowed
--> bug.rs:4:17
|
1 | fn bug<'a>(val: &'a mut serde_json::Value, pointer: &str) -> &'a mut serde_json::Value {
| -- --- binding `val` declared here
| |
| lifetime `'a` defined here
2 | match val.pointer_mut(pointer) {
| - --- borrow of `*val` occurs here
| _____|
| |
3 | | Some(v) => v,
4 | | None => val,
| | ^^^ move out of `val` occurs here
5 | | }
| |_____- returning this value requires that `*val` is borrowed for `'a`
The lifetime error in your second snippet is rust-lang/rust#21906, and the lifetime error in your first snippet is unrelated to any signatures in serde_json. The 5-year-old commit you linked doesn't have relevance to either one.
Commit
c44a7aa
removes the lifetimes onpointer
andpointer_mut
, which makes the inferred lifetimes too restrictive:The text was updated successfully, but these errors were encountered: