-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rc/Arc for DST compute layout incorrectly #55747
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Looking at the data, I think the step that is missing is to make the size a multiple of the alignment. To make the API safer it might even be useful to make Cc @eddyb |
Hm, that would however change the behavior of a stable type. ( The default allocator could at least |
|
Maybe add a method called |
|
Fix Rc/Arc allocation layout * Rounds allocation layout up to a multiple of alignment * Adds a convenience method `Layout::pad_to_align` to perform rounding Closes rust-lang#55747 cc rust-lang#55724
What if |
@RumataEstor it is probably better to raise that idea in the thread for the alloc trait: #32838 |
#54922 introduced a critical bug where the layout of an allocation is computed incorrectly, leading (at least) to a deallocation with a different size than the allocation.
This is easily demonstrated by cherry-picking RalfJung@c2e5933 and running
./x.py --stage 1 test src/liballoc
(left is the correct layout, right is what we compute):Cc @murarth
The text was updated successfully, but these errors were encountered: