[NLL] prohibit "two-phase borrows" with existing borrows? #56254
Closed
Description
@RalfJung raised this example in which the "two-phase" borrow of x
is compatible with a pre-existing share:
fn two_phase_overlapping1() {
let mut x = vec![];
let p = &x;
x.push(p.len());
}
This poses a problem for stacked borrows, as well as for the potential refactoring of moving stacked borrows into MIR lowering (#53198) -- roughly for the same reason. It might be nice to change this, but -- if so -- we've got to move quick!