std: Make vec::from_elem failure-safe
auto merge of #8780 : brson/rust/from_elem, r=thestinger