Skip to content

Commit a957cef

Browse files
committed
Fix a bunch of typos
1 parent 404c847 commit a957cef

File tree

29 files changed

+55
-55
lines changed

29 files changed

+55
-55
lines changed

Diff for: library/alloc/tests/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::mem::MaybeUninit;
33
use std::ptr::NonNull;
44

55
#[test]
6-
fn unitialized_zero_size_box() {
6+
fn uninitialized_zero_size_box() {
77
assert_eq!(
88
&*Box::<()>::new_uninit() as *const _,
99
NonNull::<MaybeUninit<()>>::dangling().as_ptr(),

Diff for: library/alloc/tests/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn test_join_for_different_lengths_with_long_separator() {
162162
}
163163

164164
#[test]
165-
fn test_join_isue_80335() {
165+
fn test_join_issue_80335() {
166166
use core::{borrow::Borrow, cell::Cell};
167167

168168
struct WeirdBorrow {

Diff for: library/core/src/alloc/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ impl Layout {
157157
///
158158
/// - If `T` is `Sized`, this function is always safe to call.
159159
/// - If the unsized tail of `T` is:
160-
/// - a [slice], then the length of the slice tail must be an intialized
160+
/// - a [slice], then the length of the slice tail must be an initialized
161161
/// integer, and the size of the *entire value*
162162
/// (dynamic tail length + statically sized prefix) must fit in `isize`.
163163
/// - a [trait object], then the vtable part of the pointer must point
164-
/// to a valid vtable for the type `T` acquired by an unsizing coersion,
164+
/// to a valid vtable for the type `T` acquired by an unsizing coercion,
165165
/// and the size of the *entire value*
166166
/// (dynamic tail length + statically sized prefix) must fit in `isize`.
167167
/// - an (unstable) [extern type], then this function is always safe to

Diff for: library/core/src/cell.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl<T: ?Sized> RefCell<T> {
898898
Ok(Ref { value: unsafe { &*self.value.get() }, borrow: b })
899899
}
900900
None => Err(BorrowError {
901-
// If a borrow occured, then we must already have an outstanding borrow,
901+
// If a borrow occurred, then we must already have an outstanding borrow,
902902
// so `borrowed_at` will be `Some`
903903
#[cfg(feature = "debug_refcell")]
904904
location: self.borrowed_at.get().unwrap(),
@@ -983,7 +983,7 @@ impl<T: ?Sized> RefCell<T> {
983983
Ok(RefMut { value: unsafe { &mut *self.value.get() }, borrow: b })
984984
}
985985
None => Err(BorrowMutError {
986-
// If a borrow occured, then we must already have an outstanding borrow,
986+
// If a borrow occurred, then we must already have an outstanding borrow,
987987
// so `borrowed_at` will be `Some`
988988
#[cfg(feature = "debug_refcell")]
989989
location: self.borrowed_at.get().unwrap(),
@@ -1104,7 +1104,7 @@ impl<T: ?Sized> RefCell<T> {
11041104
Ok(unsafe { &*self.value.get() })
11051105
} else {
11061106
Err(BorrowError {
1107-
// If a borrow occured, then we must already have an outstanding borrow,
1107+
// If a borrow occurred, then we must already have an outstanding borrow,
11081108
// so `borrowed_at` will be `Some`
11091109
#[cfg(feature = "debug_refcell")]
11101110
location: self.borrowed_at.get().unwrap(),

Diff for: library/core/src/iter/adapters/zip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl<A: Debug + TrustedRandomAccessNoCoerce, B: Debug + TrustedRandomAccessNoCoe
517517
/// * It must also be safe to drop `self` after calling `self.__iterator_get_unchecked(idx)`.
518518
/// * If `T` is a subtype of `Self`, then it must be safe to coerce `self` to `T`.
519519
//
520-
// FIXME: Clarify interaction with SourceIter/InPlaceIterable. Calling `SouceIter::as_inner`
520+
// FIXME: Clarify interaction with SourceIter/InPlaceIterable. Calling `SourceIter::as_inner`
521521
// after `__iterator_get_unchecked` is supposed to be allowed.
522522
#[doc(hidden)]
523523
#[unstable(feature = "trusted_random_access", issue = "none")]

Diff for: library/core/src/iter/range.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ range_exact_iter_impl! {
777777
usize u8 u16
778778
isize i8 i16
779779

780-
// These are incorect per the reasoning above,
780+
// These are incorrect per the reasoning above,
781781
// but removing them would be a breaking change as they were stabilized in Rust 1.0.0.
782782
// So e.g. `(0..66_000_u32).len()` for example will compile without error or warnings
783783
// on 16-bit platforms, but continue to give a wrong result.
@@ -805,7 +805,7 @@ range_incl_exact_iter_impl! {
805805
u8
806806
i8
807807

808-
// These are incorect per the reasoning above,
808+
// These are incorrect per the reasoning above,
809809
// but removing them would be a breaking change as they were stabilized in Rust 1.26.0.
810810
// So e.g. `(0..=u16::MAX).len()` for example will compile without error or warnings
811811
// on 16-bit platforms, but continue to give a wrong result.

Diff for: library/core/src/num/dec2flt/number.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Number {
4040
&& !self.many_digits
4141
}
4242

43-
/// The fast path algorithmn using machine-sized integers and floats.
43+
/// The fast path algorithm using machine-sized integers and floats.
4444
///
4545
/// This is extracted into a separate function so that it can be attempted before constructing
4646
/// a Decimal. This only works if both the mantissa and the exponent

Diff for: library/core/src/num/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Shared utilties used by both float and integer formatting.
1+
//! Shared utilities used by both float and integer formatting.
22
#![doc(hidden)]
33
#![unstable(
44
feature = "numfmt",

Diff for: library/core/src/slice/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'a, T> IterMut<'a, T> {
221221
// the length, to also allows for the fast `ptr == end` check.
222222
//
223223
// See the `next_unchecked!` and `is_empty!` macros as well as the
224-
// `post_inc_start` method for more informations.
224+
// `post_inc_start` method for more information.
225225
unsafe {
226226
assume(!ptr.is_null());
227227

Diff for: library/core/src/slice/rotate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
104104
// - overflows cannot happen for `i` since the function's safety contract ask for
105105
// `mid+right-1 = x+left+right` to be valid for writing
106106
// - underflows cannot happen because `i` must be bigger or equal to `left` for
107-
// a substraction of `left` to happen.
107+
// a subtraction of `left` to happen.
108108
//
109109
// So `x+i` is valid for reading and writing if the caller respected the contract
110110
tmp = unsafe { x.add(i).replace(tmp) };
@@ -202,7 +202,7 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
202202
loop {
203203
// SAFETY:
204204
// `left >= right` so `[mid-right, mid+right)` is valid for reading and writing
205-
// Substracting `right` from `mid` each turn is counterbalanced by the addition and
205+
// Subtracting `right` from `mid` each turn is counterbalanced by the addition and
206206
// check after it.
207207
unsafe {
208208
ptr::swap_nonoverlapping(mid.sub(right), mid, right);
@@ -218,7 +218,7 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
218218
loop {
219219
// SAFETY: `[mid-left, mid+left)` is valid for reading and writing because
220220
// `left < right` so `mid+left < mid+right`.
221-
// Adding `left` to `mid` each turn is counterbalanced by the substraction and check
221+
// Adding `left` to `mid` each turn is counterbalanced by the subtraction and check
222222
// after it.
223223
unsafe {
224224
ptr::swap_nonoverlapping(mid.sub(left), mid, left);

Diff for: library/core/src/str/iter.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ generate_pattern_iterators! {
748748
}
749749

750750
impl<'a, P: Pattern<'a>> Split<'a, P> {
751-
/// Returns remainder of the splitted string
751+
/// Returns remainder of the split string
752752
///
753753
/// # Examples
754754
///
@@ -769,7 +769,7 @@ impl<'a, P: Pattern<'a>> Split<'a, P> {
769769
}
770770

771771
impl<'a, P: Pattern<'a>> RSplit<'a, P> {
772-
/// Returns remainder of the splitted string
772+
/// Returns remainder of the split string
773773
///
774774
/// # Examples
775775
///
@@ -808,7 +808,7 @@ generate_pattern_iterators! {
808808
}
809809

810810
impl<'a, P: Pattern<'a>> SplitTerminator<'a, P> {
811-
/// Returns remainder of the splitted string
811+
/// Returns remainder of the split string
812812
///
813813
/// # Examples
814814
///
@@ -829,7 +829,7 @@ impl<'a, P: Pattern<'a>> SplitTerminator<'a, P> {
829829
}
830830

831831
impl<'a, P: Pattern<'a>> RSplitTerminator<'a, P> {
832-
/// Returns remainder of the splitted string
832+
/// Returns remainder of the split string
833833
///
834834
/// # Examples
835835
///
@@ -931,7 +931,7 @@ generate_pattern_iterators! {
931931
}
932932

933933
impl<'a, P: Pattern<'a>> SplitN<'a, P> {
934-
/// Returns remainder of the splitted string
934+
/// Returns remainder of the split string
935935
///
936936
/// # Examples
937937
///
@@ -952,7 +952,7 @@ impl<'a, P: Pattern<'a>> SplitN<'a, P> {
952952
}
953953

954954
impl<'a, P: Pattern<'a>> RSplitN<'a, P> {
955-
/// Returns remainder of the splitted string
955+
/// Returns remainder of the split string
956956
///
957957
/// # Examples
958958
///
@@ -1236,7 +1236,7 @@ impl<'a> DoubleEndedIterator for SplitWhitespace<'a> {
12361236
impl FusedIterator for SplitWhitespace<'_> {}
12371237

12381238
impl<'a> SplitWhitespace<'a> {
1239-
/// Returns remainder of the splitted string
1239+
/// Returns remainder of the split string
12401240
///
12411241
/// # Examples
12421242
///
@@ -1292,7 +1292,7 @@ impl<'a> DoubleEndedIterator for SplitAsciiWhitespace<'a> {
12921292
impl FusedIterator for SplitAsciiWhitespace<'_> {}
12931293

12941294
impl<'a> SplitAsciiWhitespace<'a> {
1295-
/// Returns remainder of the splitted string
1295+
/// Returns remainder of the split string
12961296
///
12971297
/// # Examples
12981298
///
@@ -1360,7 +1360,7 @@ impl<'a, P: Pattern<'a, Searcher: ReverseSearcher<'a>>> DoubleEndedIterator
13601360
impl<'a, P: Pattern<'a>> FusedIterator for SplitInclusive<'a, P> {}
13611361

13621362
impl<'a, P: Pattern<'a>> SplitInclusive<'a, P> {
1363-
/// Returns remainder of the splitted string
1363+
/// Returns remainder of the split string
13641364
///
13651365
/// # Examples
13661366
///

Diff for: library/core/tests/array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fn iterator_drops() {
259259
// This test does not work on targets without panic=unwind support.
260260
// To work around this problem, test is marked is should_panic, so it will
261261
// be automagically skipped on unsuitable targets, such as
262-
// wasm32-unknown-unkown.
262+
// wasm32-unknown-unknown.
263263
//
264264
// It means that we use panic for indicating success.
265265
#[test]

Diff for: library/panic_unwind/src/emcc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static EXCEPTION_TYPE_INFO: TypeInfo = TypeInfo {
4949
};
5050

5151
struct Exception {
52-
// This is necessary because C++ code can capture our execption with
52+
// This is necessary because C++ code can capture our exception with
5353
// std::exception_ptr and rethrow it multiple times, possibly even in
5454
// another thread.
5555
caught: AtomicBool,

Diff for: library/std/src/fs/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ fn symlink_hard_link() {
13691369
// "hard_link" should appear as a symlink.
13701370
assert!(check!(fs::symlink_metadata(tmpdir.join("hard_link"))).file_type().is_symlink());
13711371

1372-
// We sould be able to open "file" via any of the above names.
1372+
// We should be able to open "file" via any of the above names.
13731373
let _ = check!(fs::File::open(tmpdir.join("file")));
13741374
assert!(fs::File::open(tmpdir.join("file.renamed")).is_err());
13751375
let _ = check!(fs::File::open(tmpdir.join("symlink")));

Diff for: library/std/src/io/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,15 +362,15 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>
362362
let start_len = buf.len();
363363
let start_cap = buf.capacity();
364364

365-
let mut initialized = 0; // Extra initalized bytes from previous loop iteration
365+
let mut initialized = 0; // Extra initialized bytes from previous loop iteration
366366
loop {
367367
if buf.len() == buf.capacity() {
368368
buf.reserve(32); // buf is full, need more space
369369
}
370370

371371
let mut read_buf = ReadBuf::uninit(buf.spare_capacity_mut());
372372

373-
// SAFETY: These bytes were initalized but not filled in the previous loop
373+
// SAFETY: These bytes were initialized but not filled in the previous loop
374374
unsafe {
375375
read_buf.assume_init(initialized);
376376
}

Diff for: library/std/src/io/stdio.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ where
11791179
})
11801180
}) == Ok(Some(()))
11811181
{
1182-
// Succesfully wrote to capture buffer.
1182+
// Successfully wrote to capture buffer.
11831183
return;
11841184
}
11851185

Diff for: library/std/src/net/ip/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ fn ipv4_from_constructors() {
749749
}
750750

751751
#[test]
752-
fn ipv6_from_contructors() {
752+
fn ipv6_from_constructors() {
753753
assert_eq!(Ipv6Addr::LOCALHOST, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
754754
assert!(Ipv6Addr::LOCALHOST.is_loopback());
755755
assert_eq!(Ipv6Addr::UNSPECIFIED, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0));

Diff for: library/std/src/panicking.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
365365
// The call to `intrinsics::r#try` is made safe by:
366366
// - `do_call`, the first argument, can be called with the initial `data_ptr`.
367367
// - `do_catch`, the second argument, can be called with the `data_ptr` as well.
368-
// See their safety preconditions for more informations
368+
// See their safety preconditions for more information
369369
unsafe {
370370
return if intrinsics::r#try(do_call::<F, R>, data_ptr, do_catch::<F, R>) == 0 {
371371
Ok(ManuallyDrop::into_inner(data.r))
@@ -398,7 +398,7 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
398398
// expects normal function pointers.
399399
#[inline]
400400
fn do_call<F: FnOnce() -> R, R>(data: *mut u8) {
401-
// SAFETY: this is the responsibilty of the caller, see above.
401+
// SAFETY: this is the responsibility of the caller, see above.
402402
unsafe {
403403
let data = data as *mut Data<F, R>;
404404
let data = &mut (*data);
@@ -420,7 +420,7 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
420420
// expects normal function pointers.
421421
#[inline]
422422
fn do_catch<F: FnOnce() -> R, R>(data: *mut u8, payload: *mut u8) {
423-
// SAFETY: this is the responsibilty of the caller, see above.
423+
// SAFETY: this is the responsibility of the caller, see above.
424424
//
425425
// When `__rustc_panic_cleaner` is correctly implemented we can rely
426426
// on `obj` being the correct thing to pass to `data.p` (after wrapping

Diff for: library/std/src/sys/itron/thread.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl Thread {
126126
// In this case, `inner`'s ownership has been moved to us,
127127
// And we are responsible for dropping it. The acquire
128128
// ordering is not necessary because the parent thread made
129-
// no memory acccess needing synchronization since the call
129+
// no memory access needing synchronization since the call
130130
// to `acre_tsk`.
131131
// Safety: See above.
132132
let _ = unsafe { Box::from_raw(inner as *const _ as *mut ThreadInner) };
@@ -264,7 +264,7 @@ impl Drop for Thread {
264264
// one will ever join it.
265265
// The ownership of `self.inner` is moved to the child thread.
266266
// However, the release ordering is not necessary because we
267-
// made no memory acccess needing synchronization since the call
267+
// made no memory access needing synchronization since the call
268268
// to `acre_tsk`.
269269
}
270270
LIFECYCLE_FINISHED => {

Diff for: library/std/src/sys/unix/kernel_copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl FdMeta {
104104

105105
fn potential_sendfile_source(&self) -> bool {
106106
match self {
107-
// procfs erronously shows 0 length on non-empty readable files.
107+
// procfs erroneously shows 0 length on non-empty readable files.
108108
// and if a file is truly empty then a `read` syscall will determine that and skip the write syscall
109109
// thus there would be benefit from attempting sendfile
110110
FdMeta::Metadata(meta)

Diff for: library/std/src/sys/unix/process/process_fuchsia.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl ExitStatus {
284284
//
285285
// The other view would be to say that the caller on Fuchsia ought to know that `into_raw`
286286
// will give a raw Fuchsia status (whatever that is - I don't know, personally). That is
287-
// not possible here becaause we must return a c_int because that's what Unix (including
287+
// not possible here because we must return a c_int because that's what Unix (including
288288
// SuS and POSIX) say a wait status is, but Fuchsia apparently uses a u64, so it won't
289289
// necessarily fit.
290290
//

Diff for: library/std/src/sys/unix/weak.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<F> DlsymWeak<F> {
124124
}
125125
}
126126

127-
// Cold because it should only happen during first-time initalization.
127+
// Cold because it should only happen during first-time initialization.
128128
#[cold]
129129
unsafe fn initialize(&self) -> Option<F> {
130130
assert_eq!(mem::size_of::<F>(), mem::size_of::<usize>());

Diff for: library/std/src/sys/wasm/alloc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,31 @@ static mut DLMALLOC: dlmalloc::Dlmalloc = dlmalloc::Dlmalloc::new();
2424
unsafe impl GlobalAlloc for System {
2525
#[inline]
2626
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
27-
// SAFETY: DLMALLOC access is guranteed to be safe because the lock gives us unique and non-reentrant access.
27+
// SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access.
2828
// Calling malloc() is safe because preconditions on this function match the trait method preconditions.
2929
let _lock = lock::lock();
3030
unsafe { DLMALLOC.malloc(layout.size(), layout.align()) }
3131
}
3232

3333
#[inline]
3434
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
35-
// SAFETY: DLMALLOC access is guranteed to be safe because the lock gives us unique and non-reentrant access.
35+
// SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access.
3636
// Calling calloc() is safe because preconditions on this function match the trait method preconditions.
3737
let _lock = lock::lock();
3838
unsafe { DLMALLOC.calloc(layout.size(), layout.align()) }
3939
}
4040

4141
#[inline]
4242
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
43-
// SAFETY: DLMALLOC access is guranteed to be safe because the lock gives us unique and non-reentrant access.
43+
// SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access.
4444
// Calling free() is safe because preconditions on this function match the trait method preconditions.
4545
let _lock = lock::lock();
4646
unsafe { DLMALLOC.free(ptr, layout.size(), layout.align()) }
4747
}
4848

4949
#[inline]
5050
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
51-
// SAFETY: DLMALLOC access is guranteed to be safe because the lock gives us unique and non-reentrant access.
51+
// SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access.
5252
// Calling realloc() is safe because preconditions on this function match the trait method preconditions.
5353
let _lock = lock::lock();
5454
unsafe { DLMALLOC.realloc(ptr, layout.size(), layout.align(), new_size) }

0 commit comments

Comments
 (0)