Skip to content

Commit ac2284b

Browse files
committed
expand type name
1 parent 53c0275 commit ac2284b

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/libcore/mem.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10351035
}
10361036
}
10371037

1038-
/// A newtype to construct uninitialized instances of `T`.
1038+
/// A wrapper to construct uninitialized instances of `T`.
10391039
///
10401040
/// The compiler, in general, assumes that variables are properly initialized
10411041
/// at their respective type. For example, a variable of reference type must
@@ -1049,7 +1049,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10491049
/// use std::mem::{self, MaybeUninit};
10501050
///
10511051
/// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior!
1052-
/// // equivalent code with `MaybeUninit`
1052+
/// // equivalent code with `MaybeUninit<&i32>`
10531053
/// let x: &i32 = unsafe { MaybeUninit::zeroed().into_initialized() }; // undefined behavior!
10541054
/// ```
10551055
///
@@ -1064,7 +1064,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10641064
/// use std::mem::{self, MaybeUninit};
10651065
///
10661066
/// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior!
1067-
/// // The equivalent code with `MaybeUninit`:
1067+
/// // The equivalent code with `MaybeUninit<bool>`:
10681068
/// let b: bool = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior!
10691069
/// ```
10701070
///
@@ -1078,7 +1078,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10781078
/// use std::mem::{self, MaybeUninit};
10791079
///
10801080
/// let x: i32 = unsafe { mem::uninitialized() }; // undefined behavior!
1081-
/// // equivalent code with `MaybeUninit`
1081+
/// // equivalent code with `MaybeUninit<i32>`
10821082
/// let x: i32 = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior!
10831083
/// ```
10841084
/// (Notice that the rules around uninitialized integers are not finalized yet, but
@@ -1093,7 +1093,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10931093
/// use std::mem::MaybeUninit;
10941094
///
10951095
/// // Create an explicitly uninitialized reference. The compiler knows that data inside
1096-
/// // a `MaybeUninit` may be invalid, and hence this is not UB:
1096+
/// // a `MaybeUninit<T>` may be invalid, and hence this is not UB:
10971097
/// let mut x = MaybeUninit::<&i32>::uninitialized();
10981098
/// // Set it to a valid value.
10991099
/// x.set(&0);
@@ -1125,25 +1125,25 @@ impl<T: Copy> Clone for MaybeUninit<T> {
11251125
impl<T> MaybeUninit<T> {
11261126
/// Create a new `MaybeUninit<T>` initialized with the given value.
11271127
///
1128-
/// Note that dropping a `MaybeUninit` will never call `T`'s drop code.
1128+
/// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
11291129
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
11301130
#[unstable(feature = "maybe_uninit", issue = "53491")]
11311131
#[inline(always)]
11321132
pub const fn new(val: T) -> MaybeUninit<T> {
11331133
MaybeUninit { value: ManuallyDrop::new(val) }
11341134
}
11351135

1136-
/// Creates a new `MaybeUninit` in an uninitialized state.
1136+
/// Creates a new `MaybeUninit<T>` in an uninitialized state.
11371137
///
1138-
/// Note that dropping a `MaybeUninit` will never call `T`'s drop code.
1138+
/// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
11391139
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
11401140
#[unstable(feature = "maybe_uninit", issue = "53491")]
11411141
#[inline(always)]
11421142
pub const fn uninitialized() -> MaybeUninit<T> {
11431143
MaybeUninit { uninit: () }
11441144
}
11451145

1146-
/// Creates a new `MaybeUninit` in an uninitialized state, with the memory being
1146+
/// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being
11471147
/// filled with `0` bytes. It depends on `T` whether that already makes for
11481148
/// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,
11491149
/// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not
@@ -1190,9 +1190,9 @@ impl<T> MaybeUninit<T> {
11901190
u
11911191
}
11921192

1193-
/// Sets the value of the `MaybeUninit`. This overwrites any previous value without dropping it.
1194-
/// For your convenience, this also returns a mutable reference to the (now safely initialized)
1195-
/// contents of `self`.
1193+
/// Sets the value of the `MaybeUninit<T>`. This overwrites any previous value
1194+
/// without dropping it. For your convenience, this also returns a mutable
1195+
/// reference to the (now safely initialized) contents of `self`.
11961196
#[unstable(feature = "maybe_uninit", issue = "53491")]
11971197
#[inline(always)]
11981198
pub fn set(&mut self, val: T) -> &mut T {
@@ -1215,7 +1215,7 @@ impl<T> MaybeUninit<T> {
12151215
///
12161216
/// let mut x = MaybeUninit::<Vec<u32>>::uninitialized();
12171217
/// x.set(vec![0,1,2]);
1218-
/// // Create a reference into the `MaybeUninit`. This is okay because we initialized it.
1218+
/// // Create a reference into the `MaybeUninit<T>`. This is okay because we initialized it.
12191219
/// let x_vec = unsafe { &*x.as_ptr() };
12201220
/// assert_eq!(x_vec.len(), 3);
12211221
/// ```
@@ -1272,13 +1272,13 @@ impl<T> MaybeUninit<T> {
12721272
unsafe { &mut *self.value as *mut T }
12731273
}
12741274

1275-
/// Extracts the value from the `MaybeUninit` container. This is a great way
1275+
/// Extracts the value from the `MaybeUninit<T>` container. This is a great way
12761276
/// to ensure that the data will get dropped, because the resulting `T` is
12771277
/// subject to the usual drop handling.
12781278
///
12791279
/// # Unsafety
12801280
///
1281-
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
1281+
/// It is up to the caller to guarantee that the `MaybeUninit<T>` really is in an initialized
12821282
/// state. Calling this when the content is not yet fully initialized causes undefined
12831283
/// behavior.
12841284
///
@@ -1374,7 +1374,7 @@ impl<T> MaybeUninit<T> {
13741374
///
13751375
/// # Unsafety
13761376
///
1377-
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
1377+
/// It is up to the caller to guarantee that the `MaybeUninit<T>` really is in an initialized
13781378
/// state. Calling this when the content is not yet fully initialized causes undefined
13791379
/// behavior.
13801380
#[unstable(feature = "maybe_uninit_ref", issue = "53491")]
@@ -1387,7 +1387,7 @@ impl<T> MaybeUninit<T> {
13871387
///
13881388
/// # Unsafety
13891389
///
1390-
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
1390+
/// It is up to the caller to guarantee that the `MaybeUninit<T>` really is in an initialized
13911391
/// state. Calling this when the content is not yet fully initialized causes undefined
13921392
/// behavior.
13931393
// FIXME(#53491): We currently rely on the above being incorrect, i.e., we have references

0 commit comments

Comments
 (0)