-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Remove box_free
lang item
#100036
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
Remove box_free
lang item
#100036
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1211,8 +1211,16 @@ impl<T: ?Sized, A: Allocator> Box<T, A> { | |
|
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> { | ||
#[inline] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idk, maybe that inline increased binary size? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
fn drop(&mut self) { | ||
// FIXME: Do nothing, drop is currently performed by compiler. | ||
// the T in the Box is dropped by the compiler before the destructor is run | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw, you've probably seen this before, but just to bring everyone up to speed, one way this can be made less magical is an
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This idea is actually the end goal of all my Box related PRs |
||
|
||
let ptr = self.0; | ||
|
||
unsafe { | ||
let layout = Layout::for_value_raw(ptr.as_ptr()); | ||
self.1.deallocate(From::from(ptr.cast()), layout) | ||
} | ||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.