-
-
Notifications
You must be signed in to change notification settings - Fork 781
feat(allocator): add TakeIn::take_in_box method
#10169
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
feat(allocator): add TakeIn::take_in_box method
#10169
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #10169 will create unknown performance changesComparing Summary
Benchmarks breakdown
|
Merge activity
|
This method aims to solve many cases that need to wrapped by `Box`, See rolldown/rolldown#4003 (comment)
9d82508 to
c198578
Compare
|
@Dunqing I'm not sure if this is ideal way to implement it. I think what this is doing is:
Whereas this would be preferable:
The original I should have thought about how to handle Perhaps we should implement impl<'a, T: Dummy> for Box<'a, T> {
fn take_in_box(&mut self, allocator: &'a Allocator) -> Self {
let dummy = Box::new_in(T::dummy(allocator), allocator);
mem::replace(self, dummy)
}
} |

This method aims to solve many cases that need to wrapped by
Box, See rolldown/rolldown#4003 (comment)