Skip to content

Commit 478a3b0

Browse files
committed
typos
1 parent 1547cce commit 478a3b0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/libcore/mem.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ pub const fn needs_drop<T>() -> bool {
494494
///
495495
/// *Incorrect* usage of this function: initializing a reference with zero.
496496
///
497-
/// ```
497+
/// ```no_run
498498
/// use std::mem;
499499
///
500500
/// let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior!
@@ -987,7 +987,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
987987
///
988988
/// On top of that, remember that most types have additional invariants beyond merely
989989
/// being considered initialized at the type level. For example, a `1`-initialized [`Vec<T>`]
990-
/// is considered initialized because the only requirement the compiler knows about
990+
/// is considered initialized because the only requirement the compiler knows about it
991991
/// is that the data pointer must be non-null. Creating such a `Vec<T>` does not cause
992992
/// *immediate* undefined behavior, but will cause undefined behavior with most
993993
/// safe operations (including dropping it).
@@ -1025,8 +1025,8 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10251025
///
10261026
/// let data = unsafe {
10271027
/// // Create an uninitialized array of `MaybeUninit`. The `assume_init` is
1028-
/// // safe because we type we are claiming to have initialized here is a
1029-
/// // bunch of `MaybeUninit`, which do not require initialization.
1028+
/// // safe because the type we are claiming to have initialized here is a
1029+
/// // bunch of `MaybeUninit`s, which do not require initialization.
10301030
/// let mut data: [MaybeUninit<Vec<u32>>; 1000] = MaybeUninit::uninit().assume_init();
10311031
///
10321032
/// // Dropping a `MaybeUninit` does nothing, so if there is a panic during this loop,
@@ -1052,9 +1052,9 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10521052
///
10531053
/// unsafe {
10541054
/// // Create an uninitialized array of `MaybeUninit`. The `assume_init` is
1055-
/// // safe because we type we are claiming to have initialized here is a
1056-
/// // bunch of `MaybeUninit`, which do not require initialization.
1057-
/// let mut data: [MaybeUninit<String>; 500] = MaybeUninit::uninit().assume_init();
1055+
/// // safe because the type we are claiming to have initialized here is a
1056+
/// // bunch of `MaybeUninit`s, which do not require initialization.
1057+
/// let mut data: [MaybeUninit<String>; 1000] = MaybeUninit::uninit().assume_init();
10581058
/// // Count the number of elements we have assigned.
10591059
/// let mut data_len: usize = 0;
10601060
///

0 commit comments

Comments
 (0)