Skip to content

libcore: Get rid of useless mem::forget wrapper. #16509

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
merged 1 commit into from
Aug 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ use ptr;

pub use intrinsics::transmute;

/// Moves a thing into the void.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these docs (and even the #[stable]) may need to go on the actual definition, not the reexport.

(@aturon would know for sure about the reexport.)

///
/// The forget function will take ownership of the provided value but neglect
/// to run any required cleanup or memory management operations on it.
///
/// This function is the unsafe version of the `drop` function because it does
/// not run any destructors.
#[stable]
pub use intrinsics::forget;

/// Returns the size of a type in bytes.
#[inline]
#[stable]
Expand Down Expand Up @@ -337,17 +347,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
#[stable]
pub fn drop<T>(_x: T) { }

/// Moves a thing into the void.
///
/// The forget function will take ownership of the provided value but neglect
/// to run any required cleanup or memory management operations on it.
///
/// This function is the unsafe version of the `drop` function because it does
/// not run any destructors.
#[inline]
#[stable]
pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing) }

/// Interprets `src` as `&U`, and then reads `src` without moving the contained
/// value.
///
Expand Down