nikomatsakis / nll-rfc

Non-lexical lifetimes RFC.
47 stars 17 forks source link

2-Phase Borrows #37

Open arielb1 opened 7 years ago

arielb1 commented 7 years ago

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);
nikomatsakis commented 7 years ago

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.