Skip to content

Commit

Permalink
check ./library too
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed Dec 7, 2024
1 parent effb233 commit 9f3a0d5
Show file tree
Hide file tree
Showing 28 changed files with 62 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
if: ${{ env.CI_JOB_NAME == 'mingw-check-tidy' }}
uses: crate-ci/[email protected]
with:
files: ./compiler
files: ./compiler ./library
config: ./typos.toml

# Free up disk space on Linux by removing preinstalled components that
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
//! parameters (corresponding to `format_spec` in [the syntax](#syntax)). These
//! parameters affect the string representation of what's being formatted.
//!
//! The colon `:` in format syntax divides indentifier of the input data and
//! The colon `:` in format syntax divides identifier of the input data and
//! the formatting options, the colon itself does not change anything, only
//! introduces the options.
//!
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl<A: Allocator> RawVecInner<A> {
match Self::try_allocate_in(capacity, AllocInit::Uninitialized, alloc, elem_layout) {
Ok(this) => {
unsafe {
// Make it more obvious that a subsquent Vec::reserve(capacity) will not allocate.
// Make it more obvious that a subsequent Vec::reserve(capacity) will not allocate.
hint::assert_unchecked(!this.needs_to_grow(0, capacity, elem_layout));
}
this
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/tests/sort/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn check_is_sorted<T: Ord + Clone + Debug, S: Sort>(v: &mut [T]) {
known_good_stable_sort::sort(known_good_sorted_vec.as_mut_slice());

if is_small_test {
eprintln!("Orginal: {:?}", v_orig);
eprintln!("Original: {:?}", v_orig);
eprintln!("Expected: {:?}", known_good_sorted_vec);
eprintln!("Got: {:?}", v);
} else {
Expand Down
2 changes: 1 addition & 1 deletion library/core/benches/num/int_pow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ macro_rules! pow_bench_template {
let mut exp_iter = black_box(&exp_array).into_iter();

(0..ITERATIONS).fold((0 as IntType, false), |acc, _| {
// Sometimes constants don't propogate all the way to the
// Sometimes constants don't propagate all the way to the
// inside of the loop, so we call a custom expression every cycle
// rather than iter::repeat(CONST)
let base: IntType = $base_macro!(base_iter);
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/future/async_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<T> Future for AsyncDropOwning<T> {
let dtor = Pin::new_unchecked(
this.dtor.get_or_insert_with(|| async_drop_in_place(this.value.as_mut_ptr())),
);
// AsyncDestuctors are idempotent so Self gets idempotency as well
// AsyncDestructors are idempotent so Self gets idempotency as well
dtor.poll(cx)
}
}
Expand Down Expand Up @@ -246,7 +246,7 @@ async unsafe fn either<O: IntoFuture<Output = ()>, M: IntoFuture<Output = ()>, T
this: *mut T,
discr: <T as DiscriminantKind>::Discriminant,
) {
// SAFETY: Guaranteed by the safety section of this funtion's documentation
// SAFETY: Guaranteed by the safety section of this function's documentation
if unsafe { discriminant_value(&*this) } == discr {
drop(other);
matched.await
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3780,7 +3780,7 @@ where
/// used inside the `if const`.
/// Note that the two arms of this `if` really each become their own function, which is why the
/// macro supports setting attributes for those functions. The runtime function is always
/// markes as `#[inline]`.
/// marked as `#[inline]`.
///
/// See [`const_eval_select()`] for the rules and requirements around that intrinsic.
pub(crate) macro const_eval_select {
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extern "rust-intrinsic" {
#[rustc_nounwind]
pub fn simd_shr<T>(lhs: T, rhs: T) -> T;

/// "Ands" vectors elementwise.
/// "And"s vectors elementwise.
///
/// `T` must be a vector of integer primitive types.
#[rustc_nounwind]
Expand Down Expand Up @@ -419,7 +419,7 @@ extern "rust-intrinsic" {
#[rustc_nounwind]
pub fn simd_reduce_min<T, U>(x: T) -> U;

/// Logical "ands" all elements together.
/// Logical "and"s all elements together.
///
/// `T` must be a vector of integer or floating-point primitive types.
///
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
#![warn(multiple_supertrait_upcastable)]
#![allow(internal_features)]
#![deny(ffi_unwind_calls)]
// Do not check link redundancy on bootstraping phase
// Do not check link redundancy on bootstrapping phase
#![allow(rustdoc::redundant_explicit_links)]
#![warn(rustdoc::unescaped_backticks)]
//
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ pub(crate) mod builtin {
/// NAME is a string that represents a valid function name.
/// MODE is any of Forward, Reverse, ForwardFirst, ReverseFirst.
/// INPUT_ACTIVITIES consists of one valid activity for each input parameter.
/// OUTPUT_ACTIVITY must not be set if we implicitely return nothing (or explicitely return
/// OUTPUT_ACTIVITY must not be set if we implicitly return nothing (or explicitly return
/// `-> ()`). Otherwise it must be set to one of the allowed activities.
#[unstable(feature = "autodiff", issue = "124509")]
#[allow_internal_unstable(rustc_attrs)]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@
//!
//! 1. *Structural [`Unpin`].* A struct can be [`Unpin`] only if all of its
//! structurally-pinned fields are, too. This is [`Unpin`]'s behavior by default.
//! However, as a libray author, it is your responsibility not to write something like
//! However, as a library author, it is your responsibility not to write something like
//! <code>impl\<T> [Unpin] for Struct\<T> {}</code> and then offer a method that provides
//! structural pinning to an inner field of `T`, which may not be [`Unpin`]! (Adding *any*
//! projection operation requires unsafe code, so the fact that [`Unpin`] is a safe trait does
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,8 +1628,8 @@ mod prim_ref {}
/// let ptr: fn(usize) -> usize = add_one;
/// assert_eq!(ptr(5), 6);
///
/// let clos: fn(usize) -> usize = |x| x + 5;
/// assert_eq!(clos(5), 10);
/// let closure: fn(usize) -> usize = |x| x + 5;
/// assert_eq!(closure(5), 10);
/// ```
///
/// In addition to varying based on their signature, function pointers come in two flavors: safe
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<T: ?Sized> *const T {
if const #[rustc_allow_const_fn_unstable(const_raw_ptr_comparison)] {
match (ptr).guaranteed_eq(null_mut()) {
Some(res) => res,
// To remain maximally convervative, we stop execution when we don't
// To remain maximally conservative, we stop execution when we don't
// know whether the pointer is null or not.
// We can *not* return `false` here, that would be unsound in `NonNull::new`!
None => panic!("null-ness of this pointer cannot be determined in const context"),
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
// ^ we use this term instead of saying that the produced reference must
// be valid, as the validity of a reference is easily confused for the
// validity of the thing it refers to, and while the two concepts are
// closly related, they are not identical.
// closely related, they are not identical.
//!
//! These rules apply even if the result is unused!
//! (The part about being initialized is not yet fully decided, but until
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/str/lossy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ impl [u8] {
/// Creates an iterator over the contiguous valid UTF-8 ranges of this
/// slice, and the non-UTF-8 fragments in between.
///
/// See the [`Utf8Chunk`] type for documenation of the items yielded by this iterator.
/// See the [`Utf8Chunk`] type for documentation of the items yielded by this iterator.
///
/// # Examples
///
Expand Down Expand Up @@ -150,7 +150,7 @@ impl fmt::Debug for Debug<'_> {
/// If you want a simple conversion from UTF-8 byte slices to string slices,
/// [`from_utf8`] is easier to use.
///
/// See the [`Utf8Chunk`] type for documenation of the items yielded by this iterator.
/// See the [`Utf8Chunk`] type for documentation of the items yielded by this iterator.
///
/// [byteslice]: slice
/// [`from_utf8`]: super::from_utf8
Expand Down
2 changes: 1 addition & 1 deletion library/core/tests/iter/adapters/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn test_reverse_on_zip() {

let zipped_iter = vec_1.iter().zip(core::iter::repeat(0).take(20));

// Cannot call rev here for automatic reversed zip constuction
// Cannot call rev here for automatic reversed zip construction
for (&one, zero) in zipped_iter.rev() {
assert_eq!((1, 0), (one, zero));
}
Expand Down
2 changes: 1 addition & 1 deletion library/panic_unwind/src/seh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static mut TYPE_DESCRIPTOR: _TypeDescriptor = _TypeDescriptor {
// runtime under a try/catch block and the panic that we generate here will be
// used as the result of the exception copy. This is used by the C++ runtime to
// support capturing exceptions with std::exception_ptr, which we can't support
// because Box<dyn Any> isn't clonable.
// because Box<dyn Any> isn't cloneable.
macro_rules! define_cleanup {
($abi:tt $abi2:tt) => {
unsafe extern $abi fn exception_cleanup(e: *mut Exception) {
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/pal/uefi/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl<T> OwnedProtocol<T> {
let protocol: *mut T = Box::into_raw(Box::new(protocol));
let mut handle: r_efi::efi::Handle = crate::ptr::null_mut();

// FIXME: Move into r-efi once extended_varargs_abi_support is stablized
// FIXME: Move into r-efi once extended_varargs_abi_support is stabilized
let func: BootInstallMultipleProtocolInterfaces =
unsafe { crate::mem::transmute((*bt.as_ptr()).install_multiple_protocol_interfaces) };

Expand Down Expand Up @@ -339,7 +339,7 @@ impl<T> Drop for OwnedProtocol<T> {
// Do not deallocate a runtime protocol
if let Some(bt) = boot_services() {
let bt: NonNull<r_efi::efi::BootServices> = bt.cast();
// FIXME: Move into r-efi once extended_varargs_abi_support is stablized
// FIXME: Move into r-efi once extended_varargs_abi_support is stabilized
let func: BootUninstallMultipleProtocolInterfaces = unsafe {
crate::mem::transmute((*bt.as_ptr()).uninstall_multiple_protocol_interfaces)
};
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/uefi/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ mod uefi_env {

let mut start = 0;

// UEFI Shell returns all keys seperated by NULL.
// UEFI Shell returns all keys separated by NULL.
// End of string is denoted by two NULLs
for i in 0.. {
if unsafe { *val.add(i) } == 0 {
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/pal/unix/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ impl Instant {
// https://www.manpagez.com/man/3/clock_gettime/
//
// CLOCK_UPTIME_RAW clock that increments monotonically, in the same man-
// ner as CLOCK_MONOTONIC_RAW, but that does not incre-
// ment while the system is asleep. The returned value
// ner as CLOCK_MONOTONIC_RAW, but that does not increment
// while the system is asleep. The returned value
// is identical to the result of mach_absolute_time()
// after the appropriate mach_timebase conversion is
// applied.
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/wasip2/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl Socket {
0 => {}
_ => {
// WASI poll does not return POLLHUP or POLLERR in revents. Check if the
// connnection actually succeeded and return ok only when the socket is
// connection actually succeeded and return ok only when the socket is
// ready and no errors were found.
if let Some(e) = self.take_error()? {
return Err(e);
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/random/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//! bytes, while the non-blocking pool, once initialized using the blocking
//! pool, uses a CPRNG to return an unlimited number of random bytes. With a
//! strong enough CPRNG however, the entropy estimation didn't contribute that
//! much towards security while being an excellent vector for DoS attacs. Thus,
//! much towards security while being an excellent vector for DoS attacks. Thus,
//! the blocking pool was removed in kernel version 5.6.[^2] That patch did not
//! magically increase the quality of the non-blocking pool, however, so we can
//! safely consider it strong enough even in older kernel versions and use it
Expand All @@ -30,7 +30,7 @@
//! data the system has available at the time.
//!
//! So in conclusion, we always want the output of the non-blocking pool, but
//! may need to wait until it is initalized. The default behavior of `getrandom`
//! may need to wait until it is initialized. The default behavior of `getrandom`
//! is to wait until the non-blocking pool is initialized and then draw from there,
//! so if `getrandom` is available, we use its default to generate the bytes. For
//! `HashMap`, however, we need to specify the `GRND_INSECURE` flags, but that
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/random/unsupported.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub fn fill_bytes(_: &mut [u8]) {

pub fn hashmap_random_keys() -> (u64, u64) {
// Use allocation addresses for a bit of randomness. This isn't
// particularily secure, but there isn't really an alternative.
// particularly secure, but there isn't really an alternative.
let stack = 0u8;
let heap = Box::new(0u8);
let k1 = ptr::from_ref(&stack).addr() as u64;
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/thread_local/guard/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn enable() {

/// On platforms with key-based TLS, the system runs the destructors for us.
/// We still have to make sure that [`crate::rt::thread_cleanup`] is called,
/// however. This is done by defering the execution of a TLS destructor to
/// however. This is done by deferring the execution of a TLS destructor to
/// the next round of destruction inside the TLS destructors.
#[cfg(not(target_thread_local))]
pub fn enable() {
Expand All @@ -46,7 +46,7 @@ pub fn enable() {
unsafe extern "C" fn run(state: *mut u8) {
if state == DEFER {
// Make sure that this function is run again in the next round of
// TLS destruction. If there is no futher round, there will be leaks,
// TLS destruction. If there is no further round, there will be leaks,
// but that's okay, `thread_cleanup` is not guaranteed to be called.
unsafe { set(CLEANUP.force(), RUN) }
} else {
Expand Down
12 changes: 6 additions & 6 deletions library/std/src/sys_common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ pub trait FromInner<Inner> {
fn from_inner(inner: Inner) -> Self;
}

// Computes (value*numer)/denom without overflow, as long as both
// (numer*denom) and the overall result fit into i64 (which is the case
// Computes (value*numerator)/denom without overflow, as long as both
// (numerator*denom) and the overall result fit into i64 (which is the case
// for our time conversions).
#[allow(dead_code)] // not used on all platforms
pub fn mul_div_u64(value: u64, numer: u64, denom: u64) -> u64 {
pub fn mul_div_u64(value: u64, numerator: u64, denom: u64) -> u64 {
let q = value / denom;
let r = value % denom;
// Decompose value as (value/denom*denom + value%denom),
// substitute into (value*numer)/denom and simplify.
// r < denom, so (denom*numer) is the upper bound of (r*numer)
q * numer + r * numer / denom
// substitute into (value*numerator)/denom and simplify.
// r < denom, so (denom*numerator) is the upper bound of (r*numerator)
q * numerator + r * numerator / denom
}

pub fn ignore_notfound<T>(result: crate::io::Result<T>) -> crate::io::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/thread/current.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub(crate) fn set_current(thread: Thread) -> Result<(), Thread> {
/// one thread and is guaranteed not to call the global allocator.
#[inline]
pub(crate) fn current_id() -> ThreadId {
// If accessing the persistant thread ID takes multiple TLS accesses, try
// If accessing the persistent thread ID takes multiple TLS accesses, try
// to retrieve it from the current thread handle, which will only take one
// TLS access.
if !id::CHEAP {
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/thread/spawnhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::thread::Thread;
crate::thread_local! {
/// A thread local linked list of spawn hooks.
///
/// It is a linked list of Arcs, such that it can very cheaply be inhereted by spawned threads.
/// It is a linked list of Arcs, such that it can very cheaply be inherited by spawned threads.
///
/// (That technically makes it a set of linked lists with shared tails, so a linked tree.)
static SPAWN_HOOKS: Cell<SpawnHooks> = const { Cell::new(SpawnHooks { first: None }) };
Expand Down
24 changes: 22 additions & 2 deletions typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ extend-exclude = [
"compiler/rustc_codegen_gcc",
"compiler/rustc_codegen_cranelift",
"compiler/rustc_baked_icu_data",
"library/backtrace",
"library/stdarch",
# generated lorem ipsum texts
"library/alloc/benches/str.rs",
"library/alloc/tests/str.rs",
]

[default.extend-words]
Expand All @@ -27,6 +32,18 @@ parm = "parm"
EXCED = "EXCED"
unparseable = "unparseable"
matcheable = "matcheable"
smove = "smove"
childs = "childs"
filetimes = "filetimes"

[default.extend-identifiers]
DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME = "DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME"
ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = "ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS"
ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = "ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC"
ERROR_MCA_OCCURED = "ERROR_MCA_OCCURED"
ERRNO_ACCES = "ERRNO_ACCES"
tolen = "tolen"
pard = "pard"

[default]
extend-ignore-words-re = [
Expand All @@ -35,8 +52,11 @@ extend-ignore-words-re = [
]

extend-ignore-re = [
# ignore this intensional typo examples from lints
# ignore this intensional typo examples
"/// 1 \\| #\\[cfg\\(widnows\\)\\]",
"/// warning: unexpected `cfg` condition name: `widnows`",
"/// #\\[cfg\\(widnows\\)\\]",
]
"\\.arg\\(\"Oh no, a tpyo!\"\\)",
# string used in benches
"\"core::iter::adapters::Copie\"",
]

0 comments on commit 9f3a0d5

Please sign in to comment.