vec previously had some code that looked like this:
let vp: *T = ...;
let v = move *vp;
This had the effect of memcpying *vp to v and zeroing *vp. move is being removed so this doesn't work. I've replaced that with:
let mut vp: *T = ...;
let mut v: T = rusti::init(); // Create a zeroed value
v <-> *vp;
This could probably be more efficient by 1) not zeroing the value (in most cases), 2) not doing the swap.
Probably this is what we should do:
let mut vp: *T = ...;
let mut v: T = rusti::uninit(); // Create a non-zeroed value
ptr:memcpy(&mut T, vp, 1);
And if you need the zeroing you can do a memset.
vecpreviously had some code that looked like this:This had the effect of memcpying
*vptovand zeroing*vp.moveis being removed so this doesn't work. I've replaced that with:This could probably be more efficient by 1) not zeroing the value (in most cases), 2) not doing the swap.
Probably this is what we should do:
And if you need the zeroing you can do a memset.