Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 28, 2025. It is now read-only.
/rustPublic archive
forked fromrust-lang/rust

Commit53b7e22

Browse files
authored
Unrolled build forrust-lang#140391
Rollup merge ofrust-lang#140391 - DaniPopes:sub-ptr-rename, r=RalfJungRename sub_ptr to offset_from_unsigned in docsThere are still a few mentions of `sub_ptr` in comments and doc comments, which were missed inrust-lang#137483.
2 parents25cdf1f +f07cc40 commit53b7e22

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

‎library/alloc/src/vec/into_iter.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<T, A: Allocator> IntoIter<T, A> {
168168

169169
// SAFETY: This allocation originally came from a `Vec`, so it passes
170170
// all those checks. We have `this.buf` ≤ `this.ptr` ≤ `this.end`,
171-
// so the `sub_ptr`s below cannot wrap, and will produce a well-formed
171+
// so the `offset_from_unsigned`s below cannot wrap, and will produce a well-formed
172172
// range. `end` ≤ `buf + cap`, so the range will be in-bounds.
173173
// Taking `alloc` is ok because nothing else is going to look at it,
174174
// since our `Drop` impl isn't going to run so there's no more code.

‎library/alloc/src/vec/splice.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<I: Iterator, A: Allocator> Drop for Splice<'_, I, A> {
5959
// and moving things into the final place.
6060
// Which means we can replace the slice::Iter with pointers that won't point to deallocated
6161
// memory, so that Drain::drop is still allowed to call iter.len(), otherwise it would break
62-
// the ptr.sub_ptr contract.
62+
// the ptr.offset_from_unsigned contract.
6363
self.drain.iter =(&[]).iter();
6464

6565
unsafe{

‎library/core/src/intrinsics/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2996,7 +2996,7 @@ pub unsafe fn nontemporal_store<T>(ptr: *mut T, val: T);
29962996
#[rustc_intrinsic]
29972997
pubconstunsafefnptr_offset_from<T>(ptr:*constT,base:*constT) ->isize;
29982998

2999-
/// See documentation of `<*const T>::sub_ptr` for details.
2999+
/// See documentation of `<*const T>::offset_from_unsigned` for details.
30003000
#[rustc_nounwind]
30013001
#[rustc_intrinsic]
30023002
#[rustc_intrinsic_const_stable_indirect]

‎library/core/src/ptr/const_ptr.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,8 @@ impl<T: ?Sized> *const T {
804804
/// units of **bytes**.
805805
///
806806
/// This is purely a convenience for casting to a `u8` pointer and
807-
/// using [`sub_ptr`][pointer::offset_from_unsigned] on it. See that method for
808-
/// documentation and safety requirements.
807+
/// using [`offset_from_unsigned`][pointer::offset_from_unsigned] on it.
808+
///See that method fordocumentation and safety requirements.
809809
///
810810
/// For non-`Sized` pointees this operation considers only the data pointers,
811811
/// ignoring the metadata.
@@ -814,7 +814,7 @@ impl<T: ?Sized> *const T {
814814
#[inline]
815815
#[cfg_attr(miri, track_caller)]// even without panics, this helps for Miri backtraces
816816
pubconstunsafefnbyte_offset_from_unsigned<U: ?Sized>(self,origin:*constU) ->usize{
817-
// SAFETY: the caller must uphold the safety contract for `sub_ptr`.
817+
// SAFETY: the caller must uphold the safety contract for `offset_from_unsigned`.
818818
unsafe{self.cast::<u8>().offset_from_unsigned(origin.cast::<u8>())}
819819
}
820820

‎library/core/src/ptr/mut_ptr.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ impl<T: ?Sized> *mut T {
937937
///
938938
/// // This would be incorrect, as the pointers are not correctly ordered:
939939
/// // ptr1.offset_from(ptr2)
940+
/// ```
940941
#[stable(feature ="ptr_sub_ptr", since ="1.87.0")]
941942
#[rustc_const_stable(feature ="const_ptr_sub_ptr", since ="1.87.0")]
942943
#[inline]
@@ -945,7 +946,7 @@ impl<T: ?Sized> *mut T {
945946
where
946947
T:Sized,
947948
{
948-
// SAFETY: the caller must uphold the safety contract for `sub_ptr`.
949+
// SAFETY: the caller must uphold the safety contract for `offset_from_unsigned`.
949950
unsafe{(selfas*constT).offset_from_unsigned(origin)}
950951
}
951952

@@ -954,8 +955,8 @@ impl<T: ?Sized> *mut T {
954955
/// units of **bytes**.
955956
///
956957
/// This is purely a convenience for casting to a `u8` pointer and
957-
/// using [`sub_ptr`][pointer::offset_from_unsigned] on it. See that method for
958-
/// documentation and safety requirements.
958+
/// using [`offset_from_unsigned`][pointer::offset_from_unsigned] on it.
959+
///See that method fordocumentation and safety requirements.
959960
///
960961
/// For non-`Sized` pointees this operation considers only the data pointers,
961962
/// ignoring the metadata.
@@ -964,7 +965,7 @@ impl<T: ?Sized> *mut T {
964965
#[inline]
965966
#[cfg_attr(miri, track_caller)]// even without panics, this helps for Miri backtraces
966967
pubconstunsafefnbyte_offset_from_unsigned<U: ?Sized>(self,origin:*mutU) ->usize{
967-
// SAFETY: the caller must uphold the safety contract for `byte_sub_ptr`.
968+
// SAFETY: the caller must uphold the safety contract for `byte_offset_from_unsigned`.
968969
unsafe{(selfas*constT).byte_offset_from_unsigned(origin)}
969970
}
970971

‎library/core/src/ptr/non_null.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ impl<T: ?Sized> NonNull<T> {
906906
where
907907
T:Sized,
908908
{
909-
// SAFETY: the caller must uphold the safety contract for `sub_ptr`.
909+
// SAFETY: the caller must uphold the safety contract for `offset_from_unsigned`.
910910
unsafe{self.as_ptr().offset_from_unsigned(subtracted.as_ptr())}
911911
}
912912

@@ -915,8 +915,8 @@ impl<T: ?Sized> NonNull<T> {
915915
/// units of **bytes**.
916916
///
917917
/// This is purely a convenience for casting to a `u8` pointer and
918-
/// using [`sub_ptr`][NonNull::offset_from_unsigned] on it. See that method for
919-
/// documentation and safety requirements.
918+
/// using [`offset_from_unsigned`][NonNull::offset_from_unsigned] on it.
919+
///See that method fordocumentation and safety requirements.
920920
///
921921
/// For non-`Sized` pointees this operation considers only the data pointers,
922922
/// ignoring the metadata.
@@ -925,7 +925,7 @@ impl<T: ?Sized> NonNull<T> {
925925
#[stable(feature ="ptr_sub_ptr", since ="1.87.0")]
926926
#[rustc_const_stable(feature ="const_ptr_sub_ptr", since ="1.87.0")]
927927
pubconstunsafefnbyte_offset_from_unsigned<U: ?Sized>(self,origin:NonNull<U>) ->usize{
928-
// SAFETY: the caller must uphold the safety contract for `byte_sub_ptr`.
928+
// SAFETY: the caller must uphold the safety contract for `byte_offset_from_unsigned`.
929929
unsafe{self.as_ptr().byte_offset_from_unsigned(origin.as_ptr())}
930930
}
931931

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp