-
-
Notifications
You must be signed in to change notification settings - Fork 722
fix(allocator): remove Clone impl from Vec
#13040
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
Merged
graphite-app
merged 1 commit into
main
from
08-12-fix_allocator_remove_clone_impl_from_vec_
Aug 19, 2025
Merged
fix(allocator): remove Clone impl from Vec
#13040
graphite-app
merged 1 commit into
main
from
08-12-fix_allocator_remove_clone_impl_from_vec_
Aug 19, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
Author
This was referenced Aug 13, 2025
CodSpeed Instrumentation Performance ReportMerging #13040 will not alter performanceComparing Summary
Footnotes |
Dunqing
approved these changes
Aug 13, 2025
dda09b3 to
7eed95f
Compare
82da014 to
32f9901
Compare
7eed95f to
2535244
Compare
32f9901 to
72247e6
Compare
camc314
approved these changes
Aug 19, 2025
Contributor
Merge activity
|
`Vec::clone` method is unsound, for the same reasons as `Vec::bump` is (#13039). `clone` only takes a `&self` and then uses it to access the `&Bump` contained in `Vec`, and allocates into that arena. Because `Vec` is `Sync`, that can result in 2 threads allocating into same `Bump` simultaneously, which is UB. `Clone` is of limited use, because usually usually the contents of the `Vec` aren't `Clone`. We have `CloneIn` trait for this purpose. We don't currently use `Clone` anywhere, so we can remove it.
2535244 to
d2e8cb6
Compare
72247e6 to
9ac418d
Compare
Base automatically changed from
08-12-fix_allocator_remove_unsound_impl_sync_for_allocator_
to
main
August 19, 2025 21:41
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Vec::clonemethod is unsound, for the same reasons asVec::bumpis (#13039).cloneonly takes a&selfand then uses it to access the&Bumpcontained inVec, and allocates into that arena. BecauseVecisSync, that can result in 2 threads allocating into sameBumpsimultaneously, which is UB.Cloneis of limited use, because usually usually the contents of theVecaren'tClone. We haveCloneIntrait for this purpose.We don't currently use
Cloneanywhere, so we can remove it.