Is it safe to logically split a borrow to work around a limitation of the NLL-enabled borrow-checker?
问题 The following code involves a very subtle bit of borrow checker dodging. The code itself describes the reasoning. The questions: Is this actually safe? Is this the recommended way to express the unsafe operations performed? Should I use pointers instead? Will the new Polonius borrow checker be able to reason about patterns like this? /// Insert a new data element at a given key. pub fn insert<'a, K: Eq, V>(this: &'a mut Vec<(K, V)>, key: K, val: V) -> &'a mut V { // Safety: As indicated below