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
This may be a duplicate, but I haven't seen this resolved anywhere in the similar-looking issues. With the current nightly, the following borrow is not allowed:
let mut a = 2u;
let mut p = &mut a;
p = &mut a; // Error here: "a already borrowed"
In terms of lifetimes, the first borrow should end by the time p is being reassigned to. However, in the current version of Rust, the borrow is considered to be taken out as long as p is alive.
What is the current state of this, and are there plans to change the semantics of assignment to be able to end borrows?
The text was updated successfully, but these errors were encountered:
I think this is a duplicate of #6393 which should allow the compiler to detect that the liveness of the original value of p is immediately dead after assignment (allowing a reassignment and a re-borrow of a).
This may be a duplicate, but I haven't seen this resolved anywhere in the similar-looking issues. With the current nightly, the following borrow is not allowed:
In terms of lifetimes, the first borrow should end by the time
p
is being reassigned to. However, in the current version of Rust, the borrow is considered to be taken out as long asp
is alive.What is the current state of this, and are there plans to change the semantics of assignment to be able to end borrows?
The text was updated successfully, but these errors were encountered: