rayon-rs/rayon

UB in Collect:: reserve_get_tail_slice

Closed this issue · 1 comments

It appears that Collect::reserve_get_tail_slice might have undefined behavior. The code is reserving uninitialized space, then creating a mutable reference to it. This us UB according to this documentation.

I thought the validity of having uninitialized data behind references hasn't been decided yet (UCG#77), but I guess we could probably use &mut [MaybeUninit<T>] here.