diff options
| author | Eric Huss <eric@huss.org> | 2025-02-13 12:40:27 -0800 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2025-02-14 07:36:17 -0800 |
| commit | 4e36f46464d6473ca1f2c8612b7aed4ea0141bcf (patch) | |
| tree | 3ffedba35bea9d39d8a5c464925355b6dda74836 /library/core/src/mem | |
| parent | d88ffcdb8bfc6f8b917574c1693eb9764a20eff5 (diff) | |
core: Apply unsafe_op_in_unsafe_fn
Diffstat (limited to 'library/core/src/mem')
| -rw-r--r-- | library/core/src/mem/maybe_uninit.rs | 4 | ||||
| -rw-r--r-- | library/core/src/mem/transmutability.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 0d8c3ef906b..9ab05ca89d1 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -98,7 +98,7 @@ use crate::{fmt, intrinsics, ptr, slice}; /// /// unsafe fn make_vec(out: *mut Vec<i32>) { /// // `write` does not drop the old contents, which is important. -/// out.write(vec![1, 2, 3]); +/// unsafe { out.write(vec![1, 2, 3]); } /// } /// /// let mut v = MaybeUninit::uninit(); @@ -844,7 +844,7 @@ impl<T> MaybeUninit<T> { /// # #![allow(unexpected_cfgs)] /// use std::mem::MaybeUninit; /// - /// # unsafe extern "C" fn initialize_buffer(buf: *mut [u8; 1024]) { *buf = [0; 1024] } + /// # unsafe extern "C" fn initialize_buffer(buf: *mut [u8; 1024]) { unsafe { *buf = [0; 1024] } } /// # #[cfg(FALSE)] /// extern "C" { /// /// Initializes *all* the bytes of the input buffer. diff --git a/library/core/src/mem/transmutability.rs b/library/core/src/mem/transmutability.rs index 6a4f84c849c..7b920d7a777 100644 --- a/library/core/src/mem/transmutability.rs +++ b/library/core/src/mem/transmutability.rs @@ -32,7 +32,7 @@ use crate::marker::{ConstParamTy_, UnsizedConstParamTy}; /// src: ManuallyDrop::new(src), /// }; /// -/// let dst = transmute.dst; +/// let dst = unsafe { transmute.dst }; /// /// ManuallyDrop::into_inner(dst) /// } |
