[Discussion] Super borrow, for super let, placement new, and hybrid borrow

Just a clarification:

The borrow checker is working correctly. This signature:

fn<'this>(&'this mut self)->&'this T

Says that so long as the return type is used ('this is active), *self remains exclusively borrowed (the &mut self also has lifetime 'this).

That relationship can be relied on for soundness.

So the desired get_or_insert semantics will indeed require a new type of API, be it super borrow or something else; the existing API semantic is not a bug and can't be "fixed".

6 Likes