Implement a few methods for RingBuf

Part of collections reform part 1 and 2, #18424 and #19986

* shrink_to_fit
* swap_back_remove
* swap_front_remove
* truncate
* resize
I don't think this actually overlaps. so `ptr::copy_nonoverlapping_memory` might be safe here.