Skip to content

Commit 8760818

Browse files
committed
Fix a bunch of typo
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
1 parent ca25bdc commit 8760818

File tree

17 files changed

+26
-26
lines changed

17 files changed

+26
-26
lines changed

alloc/src/collections/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ impl<'a, T> CursorMut<'a, T> {
15701570
/// that the cursor points to is unchanged, even if it is the "ghost" node.
15711571
///
15721572
/// This operation should compute in *O*(1) time.
1573-
// `push_front` continues to point to "ghost" when it addes a node to mimic
1573+
// `push_front` continues to point to "ghost" when it adds a node to mimic
15741574
// the behavior of `insert_before` on an empty list.
15751575
#[unstable(feature = "linked_list_cursors", issue = "58533")]
15761576
pub fn push_front(&mut self, elt: T) {

alloc/src/vec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ impl<T> Vec<T> {
436436
/// an explanation of the difference between length and capacity, see
437437
/// *[Capacity and reallocation]*.
438438
///
439-
/// If it is imporant to know the exact allocated capacity of a `Vec`,
439+
/// If it is important to know the exact allocated capacity of a `Vec`,
440440
/// always use the [`capacity`] method after construction.
441441
///
442442
/// For `Vec<T>` where `T` is a zero-sized type, there will be no allocation
@@ -591,7 +591,7 @@ impl<T, A: Allocator> Vec<T, A> {
591591
/// an explanation of the difference between length and capacity, see
592592
/// *[Capacity and reallocation]*.
593593
///
594-
/// If it is imporant to know the exact allocated capacity of a `Vec`,
594+
/// If it is important to know the exact allocated capacity of a `Vec`,
595595
/// always use the [`capacity`] method after construction.
596596
///
597597
/// For `Vec<T, A>` where `T` is a zero-sized type, there will be no allocation

core/src/hint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use crate::intrinsics;
3131
///
3232
/// `unreachable_unchecked()` can be used in situations where the compiler
3333
/// can't prove invariants that were previously established. Such situations
34-
/// have a higher chance of occuring if those invariants are upheld by
34+
/// have a higher chance of occurring if those invariants are upheld by
3535
/// external code that the compiler can't analyze.
3636
/// ```
3737
/// fn prepare_inputs(divisors: &mut Vec<u32>) {

core/src/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ extern "rust-intrinsic" {
10821082
/// Note that using `transmute` to turn a pointer to a `usize` is (as noted above) [undefined
10831083
/// behavior][ub] in `const` contexts. Also outside of consts, this operation might not behave
10841084
/// as expected -- this is touching on many unspecified aspects of the Rust memory model.
1085-
/// Depending on what the code is doing, the following alternatives are preferrable to
1085+
/// Depending on what the code is doing, the following alternatives are preferable to
10861086
/// pointer-to-integer transmutation:
10871087
/// - If the code just wants to store data of arbitrary type in some buffer and needs to pick a
10881088
/// type for that buffer, it can use [`MaybeUninit`][mem::MaybeUninit].

core/src/ptr/const_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<T: ?Sized> *const T {
154154
/// This is similar to `self as usize`, which semantically discards *provenance* and
155155
/// *address-space* information. However, unlike `self as usize`, casting the returned address
156156
/// back to a pointer yields [`invalid`][], which is undefined behavior to dereference. To
157-
/// properly restore the lost information and obtain a dereferencable pointer, use
157+
/// properly restore the lost information and obtain a dereferenceable pointer, use
158158
/// [`with_addr`][pointer::with_addr] or [`map_addr`][pointer::map_addr].
159159
///
160160
/// If using those APIs is not possible because there is no way to preserve a pointer with the

core/src/ptr/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
//! isn't *pointer*-sized but address-space/offset/allocation-sized (we'll probably continue
9191
//! to conflate these notions). This would potentially make it possible to more efficiently
9292
//! target platforms where pointers are larger than offsets, such as CHERI and maybe some
93-
//! segmented architecures.
93+
//! segmented architectures.
9494
//!
9595
//! ## Provenance
9696
//!
@@ -172,7 +172,7 @@
172172
//! a pointer to a usize is generally an operation which *only* extracts the address. It is
173173
//! therefore *impossible* to construct a valid pointer from a usize because there is no way
174174
//! to restore the address-space and provenance. In other words, pointer-integer-pointer
175-
//! roundtrips are not possible (in the sense that the resulting pointer is not dereferencable).
175+
//! roundtrips are not possible (in the sense that the resulting pointer is not dereferenceable).
176176
//!
177177
//! The key insight to making this model *at all* viable is the [`with_addr`][] method:
178178
//!
@@ -272,7 +272,7 @@
272272
//!
273273
//! * Create an invalid pointer from just an address (see [`ptr::invalid`][]). This can
274274
//! be used for sentinel values like `null` *or* to represent a tagged pointer that will
275-
//! never be dereferencable. In general, it is always sound for an integer to pretend
275+
//! never be dereferenceable. In general, it is always sound for an integer to pretend
276276
//! to be a pointer "for fun" as long as you don't use operations on it which require
277277
//! it to be valid (offset, read, write, etc).
278278
//!

core/src/ptr/mut_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<T: ?Sized> *mut T {
160160
/// This is similar to `self as usize`, which semantically discards *provenance* and
161161
/// *address-space* information. However, unlike `self as usize`, casting the returned address
162162
/// back to a pointer yields [`invalid`][], which is undefined behavior to dereference. To
163-
/// properly restore the lost information and obtain a dereferencable pointer, use
163+
/// properly restore the lost information and obtain a dereferenceable pointer, use
164164
/// [`with_addr`][pointer::with_addr] or [`map_addr`][pointer::map_addr].
165165
///
166166
/// If using those APIs is not possible because there is no way to preserve a pointer with the

core/src/slice/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,10 +2754,10 @@ impl<'a, T> Iterator for RChunksMut<'a, T> {
27542754
None => 0,
27552755
};
27562756
// SAFETY: This type ensures that self.v is a valid pointer with a correct len.
2757-
// Therefore the bounds check in split_at_mut guarantess the split point is inbounds.
2757+
// Therefore the bounds check in split_at_mut guarantees the split point is inbounds.
27582758
let (head, tail) = unsafe { self.v.split_at_mut(start) };
27592759
// SAFETY: This type ensures that self.v is a valid pointer with a correct len.
2760-
// Therefore the bounds check in split_at_mut guarantess the split point is inbounds.
2760+
// Therefore the bounds check in split_at_mut guarantees the split point is inbounds.
27612761
let (nth, _) = unsafe { tail.split_at_mut(end - start) };
27622762
self.v = head;
27632763
// SAFETY: Nothing else points to or will point to the contents of this slice.

core/src/slice/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,7 @@ impl<T> [T] {
23212321
}
23222322

23232323
/// Binary searches this slice for a given element.
2324-
/// This behaves similary to [`contains`] if this slice is sorted.
2324+
/// This behaves similar to [`contains`] if this slice is sorted.
23252325
///
23262326
/// If the value is found then [`Result::Ok`] is returned, containing the
23272327
/// index of the matching element. If there are multiple matches, then any
@@ -3530,7 +3530,7 @@ impl<T> [T] {
35303530
// alignment targeted for U.
35313531
// `crate::ptr::align_offset` is called with a correctly aligned and
35323532
// valid pointer `ptr` (it comes from a reference to `self`) and with
3533-
// a size that is a power of two (since it comes from the alignement for U),
3533+
// a size that is a power of two (since it comes from the alignment for U),
35343534
// satisfying its safety constraints.
35353535
let offset = unsafe { crate::ptr::align_offset(ptr, mem::align_of::<U>()) };
35363536
if offset > self.len() {

core/src/time.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ macro_rules! try_from_secs {
12801280
let rem_msb = nanos_tmp & rem_msb_mask == 0;
12811281
let add_ns = !(rem_msb || (is_even && is_tie));
12821282

1283-
// f32 does not have enough presicion to trigger the second branch
1283+
// f32 does not have enough precision to trigger the second branch
12841284
// since it can not represent numbers between 0.999_999_940_395 and 1.0.
12851285
let nanos = nanos + add_ns as u32;
12861286
if ($mant_bits == 23) || (nanos != NANOS_PER_SEC) { (0, nanos) } else { (1, 0) }
@@ -1299,9 +1299,9 @@ macro_rules! try_from_secs {
12991299
let rem_msb = nanos_tmp & rem_msb_mask == 0;
13001300
let add_ns = !(rem_msb || (is_even && is_tie));
13011301

1302-
// f32 does not have enough presicion to trigger the second branch.
1302+
// f32 does not have enough precision to trigger the second branch.
13031303
// For example, it can not represent numbers between 1.999_999_880...
1304-
// and 2.0. Bigger values result in even smaller presicion of the
1304+
// and 2.0. Bigger values result in even smaller precision of the
13051305
// fractional part.
13061306
let nanos = nanos + add_ns as u32;
13071307
if ($mant_bits == 23) || (nanos != NANOS_PER_SEC) {

0 commit comments

Comments
 (0)