Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UB in Collect:: reserve_get_tail_slice #851

Closed
erickt opened this issue Apr 28, 2021 · 1 comment · Fixed by #852
Closed

UB in Collect:: reserve_get_tail_slice #851

erickt opened this issue Apr 28, 2021 · 1 comment · Fixed by #852

Comments

@erickt
Copy link

erickt commented Apr 28, 2021

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.

@cuviper
Copy link
Member

cuviper commented Apr 28, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants