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

Potential error in exception-safety #359

Open
Arthur-Milchior opened this issue May 5, 2022 · 0 comments · May be fixed by #418
Open

Potential error in exception-safety #359

Arthur-Milchior opened this issue May 5, 2022 · 0 comments · May be fixed by #418

Comments

@Arthur-Milchior
Copy link
Contributor

In https://doc.rust-lang.org/nomicon/exception-safety.html I suspect that self.ptr().add(i).write(x.clone()); is wrong. i is the position of x in to_push. We don't want to put x at position i as it would overwrite an already existing value. Instead we want it at position i+initial_length.
At least I assume. I don't understand how to find the documentation of ptr(), I don't see it in https://doc.rust-lang.org/stable/std/vec/struct.Vec.html . But I can't figure out a semantic off "add" where it makes sens to take "i"

@guilliamxavier guilliamxavier linked a pull request Aug 31, 2023 that will close this issue
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.

1 participant