Skip to content

Commit 955e552

Browse files
authored
Rollup merge of #91814 - japm48:spelling-fix, r=RalfJung
doc: fix typo in comments `dereferencable -> dereferenceable` Fixes #91802.
2 parents be20570 + 0d7b830 commit 955e552

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
140140

141141
sym::min_align_of_val | sym::size_of_val => {
142142
// Avoid `deref_operand` -- this is not a deref, the ptr does not have to be
143-
// dereferencable!
143+
// dereferenceable!
144144
let place = self.ref_to_mplace(&self.read_immediate(&args[0])?)?;
145145
let (size, align) = self
146146
.size_and_align_of_mplace(&place)?

compiler/rustc_const_eval/src/interpret/place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ where
327327
self.memory.get_mut(place.ptr, size, place.align)
328328
}
329329

330-
/// Check if this mplace is dereferencable and sufficiently aligned.
330+
/// Check if this mplace is dereferenceable and sufficiently aligned.
331331
fn check_mplace_access(
332332
&self,
333333
mplace: MPlaceTy<'tcx, M::PointerTag>,

library/alloc/src/collections/vec_deque/iter_mut.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::{count, wrap_index, RingSlices};
1212
/// [`iter_mut`]: super::VecDeque::iter_mut
1313
#[stable(feature = "rust1", since = "1.0.0")]
1414
pub struct IterMut<'a, T: 'a> {
15-
// Internal safety invariant: the entire slice is dereferencable.
15+
// Internal safety invariant: the entire slice is dereferenceable.
1616
ring: *mut [T],
1717
tail: usize,
1818
head: usize,
@@ -42,7 +42,7 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
4242
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4343
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
4444
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
45-
// The `IterMut` invariant also ensures everything is dereferencable.
45+
// The `IterMut` invariant also ensures everything is dereferenceable.
4646
let (front, back) = unsafe { (&*front, &*back) };
4747
f.debug_tuple("IterMut").field(&front).field(&back).finish()
4848
}
@@ -78,7 +78,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
7878
{
7979
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
8080
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
81-
// The `IterMut` invariant also ensures everything is dereferencable.
81+
// The `IterMut` invariant also ensures everything is dereferenceable.
8282
let (front, back) = unsafe { (&mut *front, &mut *back) };
8383
accum = front.iter_mut().fold(accum, &mut f);
8484
back.iter_mut().fold(accum, &mut f)
@@ -132,7 +132,7 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
132132
{
133133
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
134134
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
135-
// The `IterMut` invariant also ensures everything is dereferencable.
135+
// The `IterMut` invariant also ensures everything is dereferenceable.
136136
let (front, back) = unsafe { (&mut *front, &mut *back) };
137137
accum = back.iter_mut().rfold(accum, &mut f);
138138
front.iter_mut().rfold(accum, &mut f)

library/alloc/src/collections/vec_deque/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
10201020
#[stable(feature = "rust1", since = "1.0.0")]
10211021
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
10221022
// SAFETY: The internal `IterMut` safety invariant is established because the
1023-
// `ring` we create is a dereferencable slice for lifetime '_.
1023+
// `ring` we create is a dereferenceable slice for lifetime '_.
10241024
let ring = ptr::slice_from_raw_parts_mut(self.ptr(), self.cap());
10251025

10261026
unsafe { IterMut::new(ring, self.tail, self.head, PhantomData) }
@@ -1209,7 +1209,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
12091209
let (tail, head) = self.range_tail_head(range);
12101210

12111211
// SAFETY: The internal `IterMut` safety invariant is established because the
1212-
// `ring` we create is a dereferencable slice for lifetime '_.
1212+
// `ring` we create is a dereferenceable slice for lifetime '_.
12131213
let ring = ptr::slice_from_raw_parts_mut(self.ptr(), self.cap());
12141214

12151215
unsafe { IterMut::new(ring, tail, head, PhantomData) }

library/alloc/src/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,7 @@ impl<T: ?Sized> Weak<T> {
21212121
// a valid payload address, as the payload is at least as aligned as RcBox (usize).
21222122
ptr as *const T
21232123
} else {
2124-
// SAFETY: if is_dangling returns false, then the pointer is dereferencable.
2124+
// SAFETY: if is_dangling returns false, then the pointer is dereferenceable.
21252125
// The payload may be dropped at this point, and we have to maintain provenance,
21262126
// so use raw pointer manipulation.
21272127
unsafe { ptr::addr_of_mut!((*ptr).value) }

library/alloc/src/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ impl<T: ?Sized> Weak<T> {
17431743
// a valid payload address, as the payload is at least as aligned as ArcInner (usize).
17441744
ptr as *const T
17451745
} else {
1746-
// SAFETY: if is_dangling returns false, then the pointer is dereferencable.
1746+
// SAFETY: if is_dangling returns false, then the pointer is dereferenceable.
17471747
// The payload may be dropped at this point, and we have to maintain provenance,
17481748
// so use raw pointer manipulation.
17491749
unsafe { ptr::addr_of_mut!((*ptr).data) }

library/core/src/ptr/const_ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<T: ?Sized> *const T {
119119
///
120120
/// * The pointer must be properly aligned.
121121
///
122-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
122+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
123123
///
124124
/// * The pointer must point to an initialized instance of `T`.
125125
///
@@ -183,7 +183,7 @@ impl<T: ?Sized> *const T {
183183
///
184184
/// * The pointer must be properly aligned.
185185
///
186-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
186+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
187187
///
188188
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
189189
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
@@ -1003,7 +1003,7 @@ impl<T> *const [T] {
10031003
/// Returns a raw pointer to an element or subslice, without doing bounds
10041004
/// checking.
10051005
///
1006-
/// Calling this method with an out-of-bounds index or when `self` is not dereferencable
1006+
/// Calling this method with an out-of-bounds index or when `self` is not dereferenceable
10071007
/// is *[undefined behavior]* even if the resulting pointer is not used.
10081008
///
10091009
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
@@ -1025,7 +1025,7 @@ impl<T> *const [T] {
10251025
where
10261026
I: SliceIndex<[T]>,
10271027
{
1028-
// SAFETY: the caller ensures that `self` is dereferencable and `index` in-bounds.
1028+
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
10291029
unsafe { index.get_unchecked(self) }
10301030
}
10311031

library/core/src/ptr/mut_ptr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<T: ?Sized> *mut T {
122122
///
123123
/// * The pointer must be properly aligned.
124124
///
125-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
125+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
126126
///
127127
/// * The pointer must point to an initialized instance of `T`.
128128
///
@@ -189,7 +189,7 @@ impl<T: ?Sized> *mut T {
189189
///
190190
/// * The pointer must be properly aligned.
191191
///
192-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
192+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
193193
///
194194
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
195195
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
@@ -368,7 +368,7 @@ impl<T: ?Sized> *mut T {
368368
///
369369
/// * The pointer must be properly aligned.
370370
///
371-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
371+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
372372
///
373373
/// * The pointer must point to an initialized instance of `T`.
374374
///
@@ -434,7 +434,7 @@ impl<T: ?Sized> *mut T {
434434
///
435435
/// * The pointer must be properly aligned.
436436
///
437-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
437+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
438438
///
439439
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
440440
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
@@ -1266,7 +1266,7 @@ impl<T> *mut [T] {
12661266
/// Returns a raw pointer to an element or subslice, without doing bounds
12671267
/// checking.
12681268
///
1269-
/// Calling this method with an out-of-bounds index or when `self` is not dereferencable
1269+
/// Calling this method with an out-of-bounds index or when `self` is not dereferenceable
12701270
/// is *[undefined behavior]* even if the resulting pointer is not used.
12711271
///
12721272
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
@@ -1288,7 +1288,7 @@ impl<T> *mut [T] {
12881288
where
12891289
I: SliceIndex<[T]>,
12901290
{
1291-
// SAFETY: the caller ensures that `self` is dereferencable and `index` in-bounds.
1291+
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
12921292
unsafe { index.get_unchecked_mut(self) }
12931293
}
12941294

library/core/src/ptr/non_null.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<T: Sized> NonNull<T> {
109109
///
110110
/// * The pointer must be properly aligned.
111111
///
112-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
112+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
113113
///
114114
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
115115
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
@@ -142,7 +142,7 @@ impl<T: Sized> NonNull<T> {
142142
///
143143
/// * The pointer must be properly aligned.
144144
///
145-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
145+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
146146
///
147147
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
148148
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
@@ -289,7 +289,7 @@ impl<T: ?Sized> NonNull<T> {
289289
///
290290
/// * The pointer must be properly aligned.
291291
///
292-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
292+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
293293
///
294294
/// * The pointer must point to an initialized instance of `T`.
295295
///
@@ -338,7 +338,7 @@ impl<T: ?Sized> NonNull<T> {
338338
///
339339
/// * The pointer must be properly aligned.
340340
///
341-
/// * It must be "dereferencable" in the sense defined in [the module documentation].
341+
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
342342
///
343343
/// * The pointer must point to an initialized instance of `T`.
344344
///
@@ -604,7 +604,7 @@ impl<T> NonNull<[T]> {
604604
/// Returns a raw pointer to an element or subslice, without doing bounds
605605
/// checking.
606606
///
607-
/// Calling this method with an out-of-bounds index or when `self` is not dereferencable
607+
/// Calling this method with an out-of-bounds index or when `self` is not dereferenceable
608608
/// is *[undefined behavior]* even if the resulting pointer is not used.
609609
///
610610
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
@@ -628,7 +628,7 @@ impl<T> NonNull<[T]> {
628628
where
629629
I: SliceIndex<[T]>,
630630
{
631-
// SAFETY: the caller ensures that `self` is dereferencable and `index` in-bounds.
631+
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
632632
// As a consequence, the resulting pointer cannot be null.
633633
unsafe { NonNull::new_unchecked(self.as_ptr().get_unchecked_mut(index)) }
634634
}

library/core/src/slice/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl<T> [T] {
380380
I: SliceIndex<Self>,
381381
{
382382
// SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`;
383-
// the slice is dereferencable because `self` is a safe reference.
383+
// the slice is dereferenceable because `self` is a safe reference.
384384
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
385385
unsafe { &*index.get_unchecked(self) }
386386
}
@@ -416,7 +416,7 @@ impl<T> [T] {
416416
I: SliceIndex<Self>,
417417
{
418418
// SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`;
419-
// the slice is dereferencable because `self` is a safe reference.
419+
// the slice is dereferenceable because `self` is a safe reference.
420420
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
421421
unsafe { &mut *index.get_unchecked_mut(self) }
422422
}

library/core/src/str/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ impl str {
416416
#[inline]
417417
pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
418418
// SAFETY: the caller must uphold the safety contract for `get_unchecked`;
419-
// the slice is dereferencable because `self` is a safe reference.
419+
// the slice is dereferenceable because `self` is a safe reference.
420420
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
421421
unsafe { &*i.get_unchecked(self) }
422422
}
@@ -451,7 +451,7 @@ impl str {
451451
#[inline]
452452
pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
453453
// SAFETY: the caller must uphold the safety contract for `get_unchecked_mut`;
454-
// the slice is dereferencable because `self` is a safe reference.
454+
// the slice is dereferenceable because `self` is a safe reference.
455455
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
456456
unsafe { &mut *i.get_unchecked_mut(self) }
457457
}
@@ -504,7 +504,7 @@ impl str {
504504
#[inline]
505505
pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
506506
// SAFETY: the caller must uphold the safety contract for `get_unchecked`;
507-
// the slice is dereferencable because `self` is a safe reference.
507+
// the slice is dereferenceable because `self` is a safe reference.
508508
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
509509
unsafe { &*(begin..end).get_unchecked(self) }
510510
}
@@ -537,7 +537,7 @@ impl str {
537537
#[inline]
538538
pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str {
539539
// SAFETY: the caller must uphold the safety contract for `get_unchecked_mut`;
540-
// the slice is dereferencable because `self` is a safe reference.
540+
// the slice is dereferenceable because `self` is a safe reference.
541541
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
542542
unsafe { &mut *(begin..end).get_unchecked_mut(self) }
543543
}

0 commit comments

Comments
 (0)