Auto merge of #25187 - alexcrichton:mem-forget-safe, r=brson

This commit is an implementation of [RFC 1066][rfc] where the conclusion was
that leaking a value is a safe operation in Rust code, so updating the signature
of this function follows suit.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md

Closes #25186
This commit is contained in:
bors
2015-05-08 18:21:51 +00:00
5 changed files with 49 additions and 14 deletions

View File

@@ -31,7 +31,7 @@ impl FileDesc {
/// Extracts the actual filedescriptor without closing it.
pub fn into_raw(self) -> c_int {
let fd = self.fd;
unsafe { mem::forget(self) };
mem::forget(self);
fd
}

View File

@@ -32,7 +32,7 @@ impl Handle {
pub fn into_raw(self) -> HANDLE {
let ret = self.0;
unsafe { mem::forget(self) }
mem::forget(self);
return ret;
}