diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-09-16 01:30:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-16 01:30:28 +0200 |
| commit | 4f0c245429a0a42ea652b85a5390203bd6a12bbc (patch) | |
| tree | 3d30d18df8d91ac79e80e611d76c387bea601fd3 /library/std/src | |
| parent | 6af1bdda54abc9e919fc1137411dfc4311e05649 (diff) | |
| parent | 73e27b3e18dcbbef3a36620c4a44306e2bbdcd13 (diff) | |
| download | rust-4f0c245429a0a42ea652b85a5390203bd6a12bbc.tar.gz rust-4f0c245429a0a42ea652b85a5390203bd6a12bbc.zip | |
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
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/process.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/library/std/src/process.rs b/library/std/src/process.rs index d1960a049d9..00e2dbc9c1d 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -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() } } } |
