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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user