Skip to content

Commit 3176d11

Browse files
committed
Remove deprecated MaybeUninit slice methods
1 parent f63685d commit 3176d11

File tree

1 file changed

+2
-112
lines changed

1 file changed

+2
-112
lines changed

library/core/src/mem/maybe_uninit.rs

Lines changed: 2 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,28 +1005,6 @@ impl<T> MaybeUninit<T> {
10051005
}
10061006
}
10071007

1008-
/// Deprecated version of [`slice::assume_init_ref`].
1009-
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
1010-
#[deprecated(
1011-
note = "replaced by inherent assume_init_ref method; will eventually be removed",
1012-
since = "1.83.0"
1013-
)]
1014-
pub const unsafe fn slice_assume_init_ref(slice: &[Self]) -> &[T] {
1015-
// SAFETY: Same for both methods.
1016-
unsafe { slice.assume_init_ref() }
1017-
}
1018-
1019-
/// Deprecated version of [`slice::assume_init_mut`].
1020-
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
1021-
#[deprecated(
1022-
note = "replaced by inherent assume_init_mut method; will eventually be removed",
1023-
since = "1.83.0"
1024-
)]
1025-
pub const unsafe fn slice_assume_init_mut(slice: &mut [Self]) -> &mut [T] {
1026-
// SAFETY: Same for both methods.
1027-
unsafe { slice.assume_init_mut() }
1028-
}
1029-
10301008
/// Gets a pointer to the first element of the array.
10311009
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
10321010
#[inline(always)]
@@ -1040,94 +1018,6 @@ impl<T> MaybeUninit<T> {
10401018
pub const fn slice_as_mut_ptr(this: &mut [MaybeUninit<T>]) -> *mut T {
10411019
this.as_mut_ptr() as *mut T
10421020
}
1043-
1044-
/// Deprecated version of [`slice::write_copy_of_slice`].
1045-
#[unstable(feature = "maybe_uninit_write_slice", issue = "79995")]
1046-
#[deprecated(
1047-
note = "replaced by inherent write_copy_of_slice method; will eventually be removed",
1048-
since = "1.83.0"
1049-
)]
1050-
pub fn copy_from_slice<'a>(this: &'a mut [MaybeUninit<T>], src: &[T]) -> &'a mut [T]
1051-
where
1052-
T: Copy,
1053-
{
1054-
this.write_copy_of_slice(src)
1055-
}
1056-
1057-
/// Deprecated version of [`slice::write_clone_of_slice`].
1058-
#[unstable(feature = "maybe_uninit_write_slice", issue = "79995")]
1059-
#[deprecated(
1060-
note = "replaced by inherent write_clone_of_slice method; will eventually be removed",
1061-
since = "1.83.0"
1062-
)]
1063-
pub fn clone_from_slice<'a>(this: &'a mut [MaybeUninit<T>], src: &[T]) -> &'a mut [T]
1064-
where
1065-
T: Clone,
1066-
{
1067-
this.write_clone_of_slice(src)
1068-
}
1069-
1070-
/// Deprecated version of [`slice::write_filled`].
1071-
#[unstable(feature = "maybe_uninit_fill", issue = "117428")]
1072-
#[deprecated(
1073-
note = "replaced by inherent write_filled method; will eventually be removed",
1074-
since = "1.83.0"
1075-
)]
1076-
pub fn fill<'a>(this: &'a mut [MaybeUninit<T>], value: T) -> &'a mut [T]
1077-
where
1078-
T: Clone,
1079-
{
1080-
this.write_filled(value)
1081-
}
1082-
1083-
/// Deprecated version of [`slice::write_with`].
1084-
#[unstable(feature = "maybe_uninit_fill", issue = "117428")]
1085-
#[deprecated(
1086-
note = "replaced by inherent write_with method; will eventually be removed",
1087-
since = "1.83.0"
1088-
)]
1089-
pub fn fill_with<'a, F>(this: &'a mut [MaybeUninit<T>], mut f: F) -> &'a mut [T]
1090-
where
1091-
F: FnMut() -> T,
1092-
{
1093-
this.write_with(|_| f())
1094-
}
1095-
1096-
/// Deprecated version of [`slice::write_iter`].
1097-
#[unstable(feature = "maybe_uninit_fill", issue = "117428")]
1098-
#[deprecated(
1099-
note = "replaced by inherent write_iter method; will eventually be removed",
1100-
since = "1.83.0"
1101-
)]
1102-
pub fn fill_from<'a, I>(
1103-
this: &'a mut [MaybeUninit<T>],
1104-
it: I,
1105-
) -> (&'a mut [T], &'a mut [MaybeUninit<T>])
1106-
where
1107-
I: IntoIterator<Item = T>,
1108-
{
1109-
this.write_iter(it)
1110-
}
1111-
1112-
/// Deprecated version of [`slice::as_bytes`].
1113-
#[unstable(feature = "maybe_uninit_as_bytes", issue = "93092")]
1114-
#[deprecated(
1115-
note = "replaced by inherent as_bytes method; will eventually be removed",
1116-
since = "1.83.0"
1117-
)]
1118-
pub fn slice_as_bytes(this: &[MaybeUninit<T>]) -> &[MaybeUninit<u8>] {
1119-
this.as_bytes()
1120-
}
1121-
1122-
/// Deprecated version of [`slice::as_bytes_mut`].
1123-
#[unstable(feature = "maybe_uninit_as_bytes", issue = "93092")]
1124-
#[deprecated(
1125-
note = "replaced by inherent as_bytes_mut method; will eventually be removed",
1126-
since = "1.83.0"
1127-
)]
1128-
pub fn slice_as_bytes_mut(this: &mut [MaybeUninit<T>]) -> &mut [MaybeUninit<u8>] {
1129-
this.as_bytes_mut()
1130-
}
11311021
}
11321022

11331023
impl<T> [MaybeUninit<T>] {
@@ -1304,7 +1194,7 @@ impl<T> [MaybeUninit<T>] {
13041194
/// Fills a slice with elements returned by calling a closure for each index.
13051195
///
13061196
/// This method uses a closure to create new values. If you'd rather `Clone` a given value, use
1307-
/// [`MaybeUninit::fill`]. If you want to use the `Default` trait to generate values, you can
1197+
/// [slice::write_filled]. If you want to use the `Default` trait to generate values, you can
13081198
/// pass [`|_| Default::default()`][Default::default] as the argument.
13091199
///
13101200
/// # Panics
@@ -1463,7 +1353,7 @@ impl<T> [MaybeUninit<T>] {
14631353
/// use std::mem::MaybeUninit;
14641354
///
14651355
/// let mut uninit = [MaybeUninit::<u16>::uninit(), MaybeUninit::<u16>::uninit()];
1466-
/// let uninit_bytes = MaybeUninit::slice_as_bytes_mut(&mut uninit);
1356+
/// let uninit_bytes = uninit.as_bytes_mut();
14671357
/// uninit_bytes.write_copy_of_slice(&[0x12, 0x34, 0x56, 0x78]);
14681358
/// let vals = unsafe { uninit.assume_init_ref() };
14691359
/// if cfg!(target_endian = "little") {

0 commit comments

Comments
 (0)