-
Notifications
You must be signed in to change notification settings - Fork 13.4k
expose drop_in_place as ptr::drop_in_place #27204
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
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
/// # Undefined Behaviour | ||
/// | ||
/// This has all the same safety problems as `ptr::read` with respect to | ||
/// invalid pointers, types, and double drops. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra tabbing in these comments
The outstanding issue for this is ptr::drop_in_place vs mem::drop_in_place and whether it should take a *mut or an &mut. mem seems more consistent with mem::drop, but ptr is strictly more flexible (&mut coerces to *mut). |
(This will need a tracking issue and an |
@@ -39,6 +39,9 @@ pub use intrinsics::copy; | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
pub use intrinsics::write_bytes; | |||
|
|||
#[unstable(feature = "drop_in_place", reason = "just exposed, needs approval")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to what @huonw said about this needing issue=
now this'll also need to be applied to the definition in the intrinsics module itself to work (we don't look at reexports themselves)
r=me with @huonw's and my tweaks to the stability attribute |
afbe8ec
to
46986bf
Compare
@bors r=alexcrichton |
📌 Commit 46986bf has been approved by |
@bors r=alexcrichton (making the feature gate actually do a thing broke stuff) |
📌 Commit be29f00 has been approved by |
fsk how did that conflict even happen |
@bors r- |
@bors r=alexcrichton (This branch was super old, that's how!) |
📌 Commit 5c6f2c5 has been approved by |
(looks like travis is unhappy) |
augh run-pass test using the intrinsic |
@bors r- |
@bors r=alexcrichton |
📌 Commit 3547e8c has been approved by |
(actually did a local make-check) |
⌛ Testing commit 3547e8c with merge 58d247a... |
💔 Test failed - auto-win-msvc-64-opt |
☔ The latest upstream changes (presumably #28306) made this pull request unmergeable. Please resolve the merge conflicts. |
What's the status of this? |
@apasel422 I'm kinda AWOL; feel free to rebase if you want this to land! |
Will do! |
This is a rebase of #27204. r? @alexcrichton CC @gankro
This intrinsic is necessary to drop DSTs and should generally be the way to drop memory before manually deallocating it. As such, it should be properly exposed by the standard library.