Cross post of https://github.com/rust-lang/rust/issues/54628. See the thread for more details. The content below is a dumb summary. **Bad example** ``` // resize let mut vec1 = Vec::with_capacity(len); vec1.resize(len, 0); // extend let mut vec2 = Vec::with_capacity(len); vec2.extend(repeat(0).take(len)) ``` Also some unsafe approaches exist, but it's TBD. **Good example** ``` // vec! macro let mut vec3 = vec![0; len]; ```