nll-rfc icon indicating copy to clipboard operation
nll-rfc copied to clipboard

2-Phase Borrows

Open arielb1 opened this issue 7 years ago • 1 comments

The NLL RFC does not include any description of 2-phase borrows, which are required in order to enable nested method calls aka rust-lang/rfcs#2025:

x.push(x.len());

Or the MIR equivalent

tmp0 = &'a mut vec;
tmp1 = &'b vec;
tmp2 = Vec::len(tmp1);
Vec::push(tmp0, tmp2);

arielb1 avatar Aug 14 '17 17:08 arielb1

Yeah, I intentionally left them out because I kind of ran out of time and it seemed fairly orthogonal to me. But it would be good to include. I was intending to simply "port" the approach described in rust-lang/rfcs#2025, at least for now.

nikomatsakis avatar Aug 24 '17 11:08 nikomatsakis