Rollup merge of #73955 - hellow554:unsafe_process, r=Mark-Simulacrum

deny(unsafe_op_in_unsafe_fn) in libstd/process.rs

The libstd/process.rs part of #73904 . Wraps the two calls to an unsafe fn Initializer::nop() in an unsafe block.

Will have to wait for #73909 to be merged, because of the feature in the libstd/lib.rs
This commit is contained in:
Dylan DPC 2020-09-16 01:30:28 +02:00 committed by GitHub
commit 4f0c245429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -95,6 +95,7 @@
//! [`Read`]: io::Read
#![stable(feature = "process", since = "1.0.0")]
#![deny(unsafe_op_in_unsafe_fn)]
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten", target_env = "sgx"))))]
mod tests;
@ -321,7 +322,8 @@ impl Read for ChildStdout {
#[inline]
unsafe fn initializer(&self) -> Initializer {
Initializer::nop()
// SAFETY: Read is guaranteed to work on uninitialized memory
unsafe { Initializer::nop() }
}
}
@ -381,7 +383,8 @@ impl Read for ChildStderr {
#[inline]
unsafe fn initializer(&self) -> Initializer {
Initializer::nop()
// SAFETY: Read is guaranteed to work on uninitialized memory
unsafe { Initializer::nop() }
}
}