vec::with_capacity: do one alloc for non-managed
ptr: optimize {swap,replace,read}_ptr
Merge pull request #7682 from thestinger/vec

vec::with_capacity: do one alloc for non-managed + ptr module improvements