Add [mut_]shift_ref/[mut_]pop_ref functions, which return a pointer to the first/last item in the slice and modify the slice to exclude the returned item. Useful when writing iterators over mutable references.
Modify iterators to make them safe with the new rules.
Test that reborrowing contents of an `&'a mut &'b mut` pointer can only
be done for at most lifetime `'a`

Fixes #8624