Skip to content

Commit 4f0c245

Browse files
authored
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
2 parents 6af1bdd + 73e27b3 commit 4f0c245

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

library/std/src/process.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
//! [`Read`]: io::Read
9696
9797
#![stable(feature = "process", since = "1.0.0")]
98+
#![deny(unsafe_op_in_unsafe_fn)]
9899

99100
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten", target_env = "sgx"))))]
100101
mod tests;
@@ -321,7 +322,8 @@ impl Read for ChildStdout {
321322

322323
#[inline]
323324
unsafe fn initializer(&self) -> Initializer {
324-
Initializer::nop()
325+
// SAFETY: Read is guaranteed to work on uninitialized memory
326+
unsafe { Initializer::nop() }
325327
}
326328
}
327329

@@ -381,7 +383,8 @@ impl Read for ChildStderr {
381383

382384
#[inline]
383385
unsafe fn initializer(&self) -> Initializer {
384-
Initializer::nop()
386+
// SAFETY: Read is guaranteed to work on uninitialized memory
387+
unsafe { Initializer::nop() }
385388
}
386389
}
387390

0 commit comments

Comments
 (0)