mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-07 04:23:30 +00:00
Rollup merge of #91814 - japm48:spelling-fix, r=RalfJung
doc: fix typo in comments `dereferencable -> dereferenceable` Fixes #91802.
This commit is contained in:
commit
955e552d31
@ -140,7 +140,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
|
||||
sym::min_align_of_val | sym::size_of_val => {
|
||||
// Avoid `deref_operand` -- this is not a deref, the ptr does not have to be
|
||||
// dereferencable!
|
||||
// dereferenceable!
|
||||
let place = self.ref_to_mplace(&self.read_immediate(&args[0])?)?;
|
||||
let (size, align) = self
|
||||
.size_and_align_of_mplace(&place)?
|
||||
|
@ -327,7 +327,7 @@ where
|
||||
self.memory.get_mut(place.ptr, size, place.align)
|
||||
}
|
||||
|
||||
/// Check if this mplace is dereferencable and sufficiently aligned.
|
||||
/// Check if this mplace is dereferenceable and sufficiently aligned.
|
||||
fn check_mplace_access(
|
||||
&self,
|
||||
mplace: MPlaceTy<'tcx, M::PointerTag>,
|
||||
|
@ -12,7 +12,7 @@ use super::{count, wrap_index, RingSlices};
|
||||
/// [`iter_mut`]: super::VecDeque::iter_mut
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, T: 'a> {
|
||||
// Internal safety invariant: the entire slice is dereferencable.
|
||||
// Internal safety invariant: the entire slice is dereferenceable.
|
||||
ring: *mut [T],
|
||||
tail: usize,
|
||||
head: usize,
|
||||
@ -42,7 +42,7 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
|
||||
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
|
||||
// The `IterMut` invariant also ensures everything is dereferencable.
|
||||
// The `IterMut` invariant also ensures everything is dereferenceable.
|
||||
let (front, back) = unsafe { (&*front, &*back) };
|
||||
f.debug_tuple("IterMut").field(&front).field(&back).finish()
|
||||
}
|
||||
@ -78,7 +78,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
|
||||
{
|
||||
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
|
||||
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
|
||||
// The `IterMut` invariant also ensures everything is dereferencable.
|
||||
// The `IterMut` invariant also ensures everything is dereferenceable.
|
||||
let (front, back) = unsafe { (&mut *front, &mut *back) };
|
||||
accum = front.iter_mut().fold(accum, &mut f);
|
||||
back.iter_mut().fold(accum, &mut f)
|
||||
@ -132,7 +132,7 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
|
||||
{
|
||||
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
|
||||
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
|
||||
// The `IterMut` invariant also ensures everything is dereferencable.
|
||||
// The `IterMut` invariant also ensures everything is dereferenceable.
|
||||
let (front, back) = unsafe { (&mut *front, &mut *back) };
|
||||
accum = back.iter_mut().rfold(accum, &mut f);
|
||||
front.iter_mut().rfold(accum, &mut f)
|
||||
|
@ -1020,7 +1020,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
|
||||
// SAFETY: The internal `IterMut` safety invariant is established because the
|
||||
// `ring` we create is a dereferencable slice for lifetime '_.
|
||||
// `ring` we create is a dereferenceable slice for lifetime '_.
|
||||
let ring = ptr::slice_from_raw_parts_mut(self.ptr(), self.cap());
|
||||
|
||||
unsafe { IterMut::new(ring, self.tail, self.head, PhantomData) }
|
||||
@ -1209,7 +1209,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
||||
let (tail, head) = self.range_tail_head(range);
|
||||
|
||||
// SAFETY: The internal `IterMut` safety invariant is established because the
|
||||
// `ring` we create is a dereferencable slice for lifetime '_.
|
||||
// `ring` we create is a dereferenceable slice for lifetime '_.
|
||||
let ring = ptr::slice_from_raw_parts_mut(self.ptr(), self.cap());
|
||||
|
||||
unsafe { IterMut::new(ring, tail, head, PhantomData) }
|
||||
|
@ -2121,7 +2121,7 @@ impl<T: ?Sized> Weak<T> {
|
||||
// a valid payload address, as the payload is at least as aligned as RcBox (usize).
|
||||
ptr as *const T
|
||||
} else {
|
||||
// SAFETY: if is_dangling returns false, then the pointer is dereferencable.
|
||||
// SAFETY: if is_dangling returns false, then the pointer is dereferenceable.
|
||||
// The payload may be dropped at this point, and we have to maintain provenance,
|
||||
// so use raw pointer manipulation.
|
||||
unsafe { ptr::addr_of_mut!((*ptr).value) }
|
||||
|
@ -1743,7 +1743,7 @@ impl<T: ?Sized> Weak<T> {
|
||||
// a valid payload address, as the payload is at least as aligned as ArcInner (usize).
|
||||
ptr as *const T
|
||||
} else {
|
||||
// SAFETY: if is_dangling returns false, then the pointer is dereferencable.
|
||||
// SAFETY: if is_dangling returns false, then the pointer is dereferenceable.
|
||||
// The payload may be dropped at this point, and we have to maintain provenance,
|
||||
// so use raw pointer manipulation.
|
||||
unsafe { ptr::addr_of_mut!((*ptr).data) }
|
||||
|
@ -119,7 +119,7 @@ impl<T: ?Sized> *const T {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * The pointer must point to an initialized instance of `T`.
|
||||
///
|
||||
@ -183,7 +183,7 @@ impl<T: ?Sized> *const T {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
@ -1003,7 +1003,7 @@ impl<T> *const [T] {
|
||||
/// Returns a raw pointer to an element or subslice, without doing bounds
|
||||
/// checking.
|
||||
///
|
||||
/// Calling this method with an out-of-bounds index or when `self` is not dereferencable
|
||||
/// Calling this method with an out-of-bounds index or when `self` is not dereferenceable
|
||||
/// is *[undefined behavior]* even if the resulting pointer is not used.
|
||||
///
|
||||
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
|
||||
@ -1025,7 +1025,7 @@ impl<T> *const [T] {
|
||||
where
|
||||
I: SliceIndex<[T]>,
|
||||
{
|
||||
// SAFETY: the caller ensures that `self` is dereferencable and `index` in-bounds.
|
||||
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
|
||||
unsafe { index.get_unchecked(self) }
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * The pointer must point to an initialized instance of `T`.
|
||||
///
|
||||
@ -189,7 +189,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
@ -368,7 +368,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * The pointer must point to an initialized instance of `T`.
|
||||
///
|
||||
@ -434,7 +434,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
@ -1266,7 +1266,7 @@ impl<T> *mut [T] {
|
||||
/// Returns a raw pointer to an element or subslice, without doing bounds
|
||||
/// checking.
|
||||
///
|
||||
/// Calling this method with an out-of-bounds index or when `self` is not dereferencable
|
||||
/// Calling this method with an out-of-bounds index or when `self` is not dereferenceable
|
||||
/// is *[undefined behavior]* even if the resulting pointer is not used.
|
||||
///
|
||||
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
|
||||
@ -1288,7 +1288,7 @@ impl<T> *mut [T] {
|
||||
where
|
||||
I: SliceIndex<[T]>,
|
||||
{
|
||||
// SAFETY: the caller ensures that `self` is dereferencable and `index` in-bounds.
|
||||
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
|
||||
unsafe { index.get_unchecked_mut(self) }
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ impl<T: Sized> NonNull<T> {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
@ -142,7 +142,7 @@ impl<T: Sized> NonNull<T> {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
@ -289,7 +289,7 @@ impl<T: ?Sized> NonNull<T> {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * The pointer must point to an initialized instance of `T`.
|
||||
///
|
||||
@ -338,7 +338,7 @@ impl<T: ?Sized> NonNull<T> {
|
||||
///
|
||||
/// * The pointer must be properly aligned.
|
||||
///
|
||||
/// * It must be "dereferencable" in the sense defined in [the module documentation].
|
||||
/// * It must be "dereferenceable" in the sense defined in [the module documentation].
|
||||
///
|
||||
/// * The pointer must point to an initialized instance of `T`.
|
||||
///
|
||||
@ -604,7 +604,7 @@ impl<T> NonNull<[T]> {
|
||||
/// Returns a raw pointer to an element or subslice, without doing bounds
|
||||
/// checking.
|
||||
///
|
||||
/// Calling this method with an out-of-bounds index or when `self` is not dereferencable
|
||||
/// Calling this method with an out-of-bounds index or when `self` is not dereferenceable
|
||||
/// is *[undefined behavior]* even if the resulting pointer is not used.
|
||||
///
|
||||
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
|
||||
@ -628,7 +628,7 @@ impl<T> NonNull<[T]> {
|
||||
where
|
||||
I: SliceIndex<[T]>,
|
||||
{
|
||||
// SAFETY: the caller ensures that `self` is dereferencable and `index` in-bounds.
|
||||
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
|
||||
// As a consequence, the resulting pointer cannot be null.
|
||||
unsafe { NonNull::new_unchecked(self.as_ptr().get_unchecked_mut(index)) }
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ impl<T> [T] {
|
||||
I: SliceIndex<Self>,
|
||||
{
|
||||
// SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`;
|
||||
// the slice is dereferencable because `self` is a safe reference.
|
||||
// the slice is dereferenceable because `self` is a safe reference.
|
||||
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
|
||||
unsafe { &*index.get_unchecked(self) }
|
||||
}
|
||||
@ -416,7 +416,7 @@ impl<T> [T] {
|
||||
I: SliceIndex<Self>,
|
||||
{
|
||||
// SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`;
|
||||
// the slice is dereferencable because `self` is a safe reference.
|
||||
// the slice is dereferenceable because `self` is a safe reference.
|
||||
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
|
||||
unsafe { &mut *index.get_unchecked_mut(self) }
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ impl str {
|
||||
#[inline]
|
||||
pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
|
||||
// SAFETY: the caller must uphold the safety contract for `get_unchecked`;
|
||||
// the slice is dereferencable because `self` is a safe reference.
|
||||
// the slice is dereferenceable because `self` is a safe reference.
|
||||
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
|
||||
unsafe { &*i.get_unchecked(self) }
|
||||
}
|
||||
@ -451,7 +451,7 @@ impl str {
|
||||
#[inline]
|
||||
pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
|
||||
// SAFETY: the caller must uphold the safety contract for `get_unchecked_mut`;
|
||||
// the slice is dereferencable because `self` is a safe reference.
|
||||
// the slice is dereferenceable because `self` is a safe reference.
|
||||
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
|
||||
unsafe { &mut *i.get_unchecked_mut(self) }
|
||||
}
|
||||
@ -504,7 +504,7 @@ impl str {
|
||||
#[inline]
|
||||
pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
|
||||
// SAFETY: the caller must uphold the safety contract for `get_unchecked`;
|
||||
// the slice is dereferencable because `self` is a safe reference.
|
||||
// the slice is dereferenceable because `self` is a safe reference.
|
||||
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
|
||||
unsafe { &*(begin..end).get_unchecked(self) }
|
||||
}
|
||||
@ -537,7 +537,7 @@ impl str {
|
||||
#[inline]
|
||||
pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str {
|
||||
// SAFETY: the caller must uphold the safety contract for `get_unchecked_mut`;
|
||||
// the slice is dereferencable because `self` is a safe reference.
|
||||
// the slice is dereferenceable because `self` is a safe reference.
|
||||
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
|
||||
unsafe { &mut *(begin..end).get_unchecked_mut(self) }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user