Skip to content

Commit

Permalink
Rollup merge of rust-lang#73955 - hellow554:unsafe_process, r=Mark-Si…
Browse files Browse the repository at this point in the history
…mulacrum

deny(unsafe_op_in_unsafe_fn) in libstd/process.rs

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

Will have to wait for rust-lang#73909 to be merged, because of the feature in the libstd/lib.rs
  • Loading branch information
Dylan-DPC authored Sep 15, 2020
2 parents 6af1bdd + 73e27b3 commit 4f0c245
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() }
}
}

Expand Down Expand Up @@ -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() }
}
}

Expand Down

0 comments on commit 4f0c245

Please sign in to comment.