libcollections: Fix RingBuf growth for non-power-of-two capacities
auto merge of #16314 : Ryman/rust/ringbuf_non_pow2, r=huonw

See test for details.