Rollup merge of #110419 - jsoref:spelling-library, r=jyn514

Spelling library

Split per https://github.com/rust-lang/rust/pull/110392

I can squash once people are happy w/ the changes. It's really uncommon for large sets of changes to be perfectly acceptable w/o at least some changes.

I probably won't have time to respond until tomorrow or the next day
This commit is contained in:
Matthias Krüger 2023-04-26 18:51:41 +02:00 committed by GitHub
commit 9babe98562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 61 additions and 60 deletions

View File

@ -12,7 +12,7 @@ where
default fn spec_from_iter(iterator: I) -> Self {
// Since converting is O(1) now, just re-use the `Vec` logic for
// anything where we can't do something extra-special for `VecDeque`,
// especially as that could save us some monomorphiziation work
// especially as that could save us some monomorphization work
// if one uses the same iterators (like slice ones) with both.
crate::vec::Vec::from_iter(iterator).into()
}

View File

@ -404,12 +404,12 @@ impl str {
// See https://www.unicode.org/versions/Unicode7.0.0/ch03.pdf#G33992
// for the definition of `Final_Sigma`.
debug_assert!('Σ'.len_utf8() == 2);
let is_word_final = case_ignoreable_then_cased(from[..i].chars().rev())
&& !case_ignoreable_then_cased(from[i + 2..].chars());
let is_word_final = case_ignorable_then_cased(from[..i].chars().rev())
&& !case_ignorable_then_cased(from[i + 2..].chars());
to.push_str(if is_word_final { "ς" } else { "σ" });
}
fn case_ignoreable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
fn case_ignorable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
use core::unicode::{Case_Ignorable, Cased};
match iter.skip_while(|&c| Case_Ignorable(c)).next() {
Some(c) => Cased(c),

View File

@ -201,7 +201,7 @@ where
//
// Note: This access to the source wouldn't be allowed by the TrustedRandomIteratorNoCoerce
// contract (used by SpecInPlaceCollect below). But see the "O(1) collect" section in the
// module documenttation why this is ok anyway.
// module documentation why this is ok anyway.
let dst_guard = InPlaceDstBufDrop { ptr: dst_buf, len, cap };
src.forget_allocation_drop_remaining();
mem::forget(dst_guard);

View File

@ -705,7 +705,7 @@ fn test_move_rev_iterator() {
}
#[test]
fn test_splitator() {
fn test_split_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1], &[3], &[5]];
@ -725,7 +725,7 @@ fn test_splitator() {
}
#[test]
fn test_splitator_inclusive() {
fn test_split_iterator_inclusive() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
@ -745,7 +745,7 @@ fn test_splitator_inclusive() {
}
#[test]
fn test_splitator_inclusive_reverse() {
fn test_split_iterator_inclusive_reverse() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
@ -765,7 +765,7 @@ fn test_splitator_inclusive_reverse() {
}
#[test]
fn test_splitator_mut_inclusive() {
fn test_split_iterator_mut_inclusive() {
let xs = &mut [1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
@ -785,7 +785,7 @@ fn test_splitator_mut_inclusive() {
}
#[test]
fn test_splitator_mut_inclusive_reverse() {
fn test_split_iterator_mut_inclusive_reverse() {
let xs = &mut [1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
@ -805,7 +805,7 @@ fn test_splitator_mut_inclusive_reverse() {
}
#[test]
fn test_splitnator() {
fn test_splitn_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
@ -821,7 +821,7 @@ fn test_splitnator() {
}
#[test]
fn test_splitnator_mut() {
fn test_splitn_iterator_mut() {
let xs = &mut [1, 2, 3, 4, 5];
let splits: &[&mut [_]] = &[&mut [1, 2, 3, 4, 5]];
@ -837,7 +837,7 @@ fn test_splitnator_mut() {
}
#[test]
fn test_rsplitator() {
fn test_rsplit_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[5], &[3], &[1]];
@ -855,7 +855,7 @@ fn test_rsplitator() {
}
#[test]
fn test_rsplitnator() {
fn test_rsplitn_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
@ -932,7 +932,7 @@ fn test_split_iterators_size_hint() {
}
#[test]
fn test_windowsator() {
fn test_windows_iterator() {
let v = &[1, 2, 3, 4];
let wins: &[&[_]] = &[&[1, 2], &[2, 3], &[3, 4]];
@ -948,13 +948,13 @@ fn test_windowsator() {
#[test]
#[should_panic]
fn test_windowsator_0() {
fn test_windows_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.windows(0);
}
#[test]
fn test_chunksator() {
fn test_chunks_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.chunks(2).len(), 3);
@ -972,13 +972,13 @@ fn test_chunksator() {
#[test]
#[should_panic]
fn test_chunksator_0() {
fn test_chunks_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.chunks(0);
}
#[test]
fn test_chunks_exactator() {
fn test_chunks_exact_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.chunks_exact(2).len(), 2);
@ -996,13 +996,13 @@ fn test_chunks_exactator() {
#[test]
#[should_panic]
fn test_chunks_exactator_0() {
fn test_chunks_exact_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.chunks_exact(0);
}
#[test]
fn test_rchunksator() {
fn test_rchunks_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.rchunks(2).len(), 3);
@ -1020,13 +1020,13 @@ fn test_rchunksator() {
#[test]
#[should_panic]
fn test_rchunksator_0() {
fn test_rchunks_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.rchunks(0);
}
#[test]
fn test_rchunks_exactator() {
fn test_rchunks_exact_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.rchunks_exact(2).len(), 2);
@ -1044,7 +1044,7 @@ fn test_rchunks_exactator() {
#[test]
#[should_panic]
fn test_rchunks_exactator_0() {
fn test_rchunks_exact_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.rchunks_exact(0);
}
@ -1219,7 +1219,7 @@ fn test_ends_with() {
}
#[test]
fn test_mut_splitator() {
fn test_mut_split_iterator() {
let mut xs = [0, 1, 0, 2, 3, 0, 0, 4, 5, 0];
assert_eq!(xs.split_mut(|x| *x == 0).count(), 6);
for slice in xs.split_mut(|x| *x == 0) {
@ -1235,7 +1235,7 @@ fn test_mut_splitator() {
}
#[test]
fn test_mut_splitator_rev() {
fn test_mut_split_iterator_rev() {
let mut xs = [1, 2, 0, 3, 4, 0, 0, 5, 6, 0];
for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
slice.reverse();

View File

@ -2470,7 +2470,7 @@ fn test_vec_dedup_panicking() {
// Regression test for issue #82533
#[test]
fn test_extend_from_within_panicing_clone() {
fn test_extend_from_within_panicking_clone() {
struct Panic<'dc> {
drop_count: &'dc AtomicU32,
aaaaa: bool,

View File

@ -109,14 +109,14 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
/// .field("bar", &self.bar) // We add `bar` field.
/// .field("another", &self.another) // We add `another` field.
/// // We even add a field which doesn't exist (because why not?).
/// .field("not_existing_field", &1)
/// .field("nonexistent_field", &1)
/// .finish() // We're good to go!
/// }
/// }
///
/// assert_eq!(
/// format!("{:?}", Bar { bar: 10, another: "Hello World".to_string() }),
/// "Bar { bar: 10, another: \"Hello World\", not_existing_field: 1 }",
/// "Bar { bar: 10, another: \"Hello World\", nonexistent_field: 1 }",
/// );
/// ```
#[stable(feature = "debug_builders", since = "1.2.0")]

View File

@ -2474,7 +2474,7 @@ extern "rust-intrinsic" {
/// This macro should be called as `assert_unsafe_precondition!([Generics](name: Type) => Expression)`
/// where the names specified will be moved into the macro as captured variables, and defines an item
/// to call `const_eval_select` on. The tokens inside the square brackets are used to denote generics
/// for the function declaractions and can be omitted if there is no generics.
/// for the function declarations and can be omitted if there is no generics.
///
/// # Safety
///
@ -2733,7 +2733,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
// SAFETY: the safety contract for `copy` must be upheld by the caller.
unsafe {
assert_unsafe_precondition!(
"ptr::copy requires that both pointer arguments are aligned aligned and non-null",
"ptr::copy requires that both pointer arguments are aligned and non-null",
[T](src: *const T, dst: *mut T) =>
is_aligned_and_not_null(src) && is_aligned_and_not_null(dst)
);

View File

@ -42,7 +42,7 @@ the successful result of some computation, `Ok(T)`, or error types that
represent an anticipated runtime failure mode of that computation, `Err(E)`.
`Result` is used alongside user defined types which represent the various
anticipated runtime failure modes that the associated computation could
encounter. `Result` must be propagated manually, often with the the help of the
encounter. `Result` must be propagated manually, often with the help of the
`?` operator and `Try` trait, and they must be reported manually, often with
the help of the `Error` trait.

View File

@ -264,7 +264,7 @@ impl<T: ?Sized> *const T {
let dest_addr = addr as isize;
let offset = dest_addr.wrapping_sub(self_addr);
// This is the canonical desugarring of this operation
// This is the canonical desugaring of this operation
self.wrapping_byte_offset(offset)
}

View File

@ -2126,7 +2126,7 @@ mod new_fn_ptr_impl {
/// assert_eq!(unsafe { raw_f2.read_unaligned() }, 2);
/// ```
///
/// See [`addr_of_mut`] for how to create a pointer to unininitialized data.
/// See [`addr_of_mut`] for how to create a pointer to uninitialized data.
/// Doing that with `addr_of` would not make much sense since one could only
/// read the data, and that would be Undefined Behavior.
#[stable(feature = "raw_ref_macros", since = "1.51.0")]

View File

@ -270,7 +270,7 @@ impl<T: ?Sized> *mut T {
let dest_addr = addr as isize;
let offset = dest_addr.wrapping_sub(self_addr);
// This is the canonical desugarring of this operation
// This is the canonical desugaring of this operation
self.wrapping_byte_offset(offset)
}

View File

@ -4451,7 +4451,7 @@ impl<T, const N: usize> SlicePattern for [T; N] {
/// This will do `binomial(N + 1, 2) = N * (N + 1) / 2 = 0, 1, 3, 6, 10, ..`
/// comparison operations.
fn get_many_check_valid<const N: usize>(indices: &[usize; N], len: usize) -> bool {
// NB: The optimzer should inline the loops into a sequence
// NB: The optimizer should inline the loops into a sequence
// of instructions without additional branching.
let mut valid = true;
for (i, &idx) in indices.iter().enumerate() {

View File

@ -24,7 +24,7 @@ struct NoCopyNoDebug;
struct NoDebug;
test!(
capture_with_non_copyable_and_non_debugabble_elem_has_correct_params,
capture_with_non_copyable_and_non_debuggable_elem_has_correct_params,
NoCopyNoDebug,
None,
"N/A"
@ -32,6 +32,6 @@ test!(
test!(capture_with_non_copyable_elem_has_correct_params, NoCopy, None, "N/A");
test!(capture_with_non_debugabble_elem_has_correct_params, NoDebug, None, "N/A");
test!(capture_with_non_debuggable_elem_has_correct_params, NoDebug, None, "N/A");
test!(capture_with_copyable_and_debugabble_elem_has_correct_params, 1i32, Some(1i32), "1");
test!(capture_with_copyable_and_debuggable_elem_has_correct_params, 1i32, Some(1i32), "1");

View File

@ -10,7 +10,7 @@ fn once_cell() {
c.get_or_init(|| 92);
assert_eq!(c.get(), Some(&92));
c.get_or_init(|| panic!("Kabom!"));
c.get_or_init(|| panic!("Kaboom!"));
assert_eq!(c.get(), Some(&92));
}

View File

@ -170,7 +170,7 @@ fn test_can_not_overflow() {
for base in 2..=36 {
let num = (<$t>::MAX as u128) + 1;
// Calcutate the string length for the smallest overflowing number:
// Calculate the string length for the smallest overflowing number:
let max_len_string = format_radix(num, base as u128);
// Ensure that string length is deemed to potentially overflow:
assert!(can_overflow::<$t>(base, &max_len_string));

View File

@ -831,9 +831,9 @@ fn partial_line_buffered_after_line_write() {
assert_eq!(&writer.get_ref().buffer, b"Line 1\nLine 2\nLine 3");
}
/// Test that, given a partial line that exceeds the length of
/// LineBuffer's buffer (that is, without a trailing newline), that that
/// line is written to the inner writer
/// Test that for calls to LineBuffer::write where the passed bytes do not contain
/// a newline and on their own are greater in length than the internal buffer, the
/// passed bytes are immediately written to the inner writer.
#[test]
fn long_line_flushed() {
let writer = ProgrammableSink::default();
@ -844,9 +844,10 @@ fn long_line_flushed() {
}
/// Test that, given a very long partial line *after* successfully
/// flushing a complete line, that that line is buffered unconditionally,
/// and no additional writes take place. This assures the property that
/// `write` should make at-most-one attempt to write new data.
/// flushing a complete line, the very long partial line is buffered
/// unconditionally, and no additional writes take place. This assures
/// the property that `write` should make at-most-one attempt to write
/// new data.
#[test]
fn line_long_tail_not_flushed() {
let writer = ProgrammableSink::default();

View File

@ -36,7 +36,7 @@ fn initialize_unfilled() {
}
#[test]
fn addvance_filled() {
fn advance_filled() {
let buf: &mut [_] = &mut [0; 16];
let mut rbuf: BorrowedBuf<'_> = buf.into();

View File

@ -1925,7 +1925,7 @@ mod type_keyword {}
/// `unsafe_op_in_unsafe_fn` lint can be enabled to warn against that and require explicit unsafe
/// blocks even inside `unsafe fn`.
///
/// See the [Rustnomicon] and the [Reference] for more information.
/// See the [Rustonomicon] and the [Reference] for more information.
///
/// # Examples
///
@ -2129,7 +2129,7 @@ mod type_keyword {}
/// [`impl`]: keyword.impl.html
/// [raw pointers]: ../reference/types/pointer.html
/// [memory safety]: ../book/ch19-01-unsafe-rust.html
/// [Rustnomicon]: ../nomicon/index.html
/// [Rustonomicon]: ../nomicon/index.html
/// [nomicon-soundness]: ../nomicon/safe-unsafe-meaning.html
/// [soundness]: https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library
/// [Reference]: ../reference/unsafety.html

View File

@ -450,7 +450,7 @@ impl AsHandle for OwnedHandle {
#[inline]
fn as_handle(&self) -> BorrowedHandle<'_> {
// Safety: `OwnedHandle` and `BorrowedHandle` have the same validity
// invariants, and the `BorrowdHandle` is bounded by the lifetime
// invariants, and the `BorrowedHandle` is bounded by the lifetime
// of `&self`.
unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) }
}

View File

@ -260,7 +260,7 @@ impl AsSocket for OwnedSocket {
#[inline]
fn as_socket(&self) -> BorrowedSocket<'_> {
// Safety: `OwnedSocket` and `BorrowedSocket` have the same validity
// invariants, and the `BorrowdSocket` is bounded by the lifetime
// invariants, and the `BorrowedSocket` is bounded by the lifetime
// of `&self`.
unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) }
}

View File

@ -24,7 +24,7 @@ fn sync_once_cell() {
assert_eq!(ONCE_CELL.get(), Some(&92));
});
ONCE_CELL.get_or_init(|| panic!("Kabom!"));
ONCE_CELL.get_or_init(|| panic!("Kaboom!"));
assert_eq!(ONCE_CELL.get(), Some(&92));
}

View File

@ -7,7 +7,7 @@ use crate::panic::{RefUnwindSafe, UnwindSafe};
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
use crate::sys::locks as sys;
/// A re-entrant mutual exclusion
/// A reentrant mutual exclusion
///
/// This mutex will block *other* threads waiting for the lock to become
/// available. The thread which has already locked the mutex can lock it

View File

@ -58,7 +58,7 @@ IMAGE_BASE:
globvar DEBUG 1
/* The base address (relative to enclave start) of the enclave text section */
globvar TEXT_BASE 8
/* The size in bytes of enclacve text section */
/* The size in bytes of enclave text section */
globvar TEXT_SIZE 8
/* The base address (relative to enclave start) of the enclave .eh_frame_hdr section */
globvar EH_FRM_HDR_OFFSET 8
@ -66,7 +66,7 @@ IMAGE_BASE:
globvar EH_FRM_HDR_LEN 8
/* The base address (relative to enclave start) of the enclave .eh_frame section */
globvar EH_FRM_OFFSET 8
/* The size in bytes of enclacve .eh_frame section */
/* The size in bytes of enclave .eh_frame section */
globvar EH_FRM_LEN 8
.org .Lxsave_clear+512

View File

@ -735,7 +735,7 @@ impl ExitStatus {
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
// true for a platform pretending to be Unix, the tests (our doctests, and also
// procsss_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
// process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
match NonZero_c_int::try_from(self.0) {
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
/* was zero, couldn't convert */ Err(_) => Ok(()),

View File

@ -199,7 +199,7 @@ impl ExitStatus {
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
// true for a platform pretending to be Unix, the tests (our doctests, and also
// procsss_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
// process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
match NonZero_c_int::try_from(self.0) {
Ok(failure) => Err(ExitStatusError(failure)),
Err(_) => Ok(()),

View File

@ -494,7 +494,7 @@ impl Builder {
MaybeDangling(mem::MaybeUninit::new(x))
}
fn into_inner(self) -> T {
// SAFETY: we are always initiailized.
// SAFETY: we are always initialized.
let ret = unsafe { self.0.assume_init_read() };
// Make sure we don't drop.
mem::forget(self);
@ -503,7 +503,7 @@ impl Builder {
}
impl<T> Drop for MaybeDangling<T> {
fn drop(&mut self) {
// SAFETY: we are always initiailized.
// SAFETY: we are always initialized.
unsafe { self.0.assume_init_drop() };
}
}