mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Rollup merge of #97565 - lukas-code:patch-1, r=thomcc
Add doc alias `memset` to `write_bytes` I were looking for `memset` in rust, but the docs only pointed me to `slice::fill`. With only the old aliases, one might write code like this, which is incorrect if the memory is uninitialized. ``` Rust core::slice::from_raw_parts(ptr, len).fill(0) ```
This commit is contained in:
@@ -2287,6 +2287,7 @@ pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -
|
||||
/// // Now the box is fine
|
||||
/// assert_eq!(*v, 42);
|
||||
/// ```
|
||||
#[doc(alias = "memset")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
|
||||
#[inline]
|
||||
|
||||
@@ -1412,6 +1412,7 @@ pub unsafe fn drop_in_place(self) {
|
||||
/// See [`ptr::write_bytes`] for safety concerns and examples.
|
||||
///
|
||||
/// [`ptr::write_bytes`]: crate::ptr::write_bytes()
|
||||
#[doc(alias = "memset")]
|
||||
#[stable(feature = "pointer_methods", since = "1.26.0")]
|
||||
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
|
||||
#[inline(always)]
|
||||
|
||||
Reference in New Issue
Block a user