[ACP 362] genericize ptr::from_raw_parts
· model-checking/verify-rust-std@d82378a (original) (raw)
`@@ -565,7 +565,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
`
565
565
`#[rustc_allow_const_fn_unstable(ptr_metadata)]
`
566
566
`#[rustc_diagnostic_item = "ptr_null"]
`
567
567
`pub const fn null<T: ?Sized + Thin>() -> *const T {
`
568
``
`-
from_raw_parts(without_provenance(0), ())
`
``
568
`+
from_raw_parts(without_provenance::<()>(0), ())
`
569
569
`}
`
570
570
``
571
571
`/// Creates a null mutable raw pointer.
`
`@@ -591,7 +591,7 @@ pub const fn null<T: ?Sized + Thin>() -> *const T {
`
591
591
`#[rustc_allow_const_fn_unstable(ptr_metadata)]
`
592
592
`#[rustc_diagnostic_item = "ptr_null_mut"]
`
593
593
`pub const fn null_mut<T: ?Sized + Thin>() -> *mut T {
`
594
``
`-
from_raw_parts_mut(without_provenance_mut(0), ())
`
``
594
`+
from_raw_parts_mut(without_provenance_mut::<()>(0), ())
`
595
595
`}
`
596
596
``
597
597
`/// Creates a pointer with the given address and no provenance.
`
`@@ -835,7 +835,7 @@ pub const fn from_mut<T: ?Sized>(r: &mut T) -> *mut T {
`
835
835
`#[rustc_allow_const_fn_unstable(ptr_metadata)]
`
836
836
`#[rustc_diagnostic_item = "ptr_slice_from_raw_parts"]
`
837
837
`pub const fn slice_from_raw_parts(data: *const T, len: usize) -> *const [T] {
`
838
``
`-
intrinsics::aggregate_raw_ptr(data, len)
`
``
838
`+
from_raw_parts(data, len)
`
839
839
`}
`
840
840
``
841
841
`/// Forms a raw mutable slice from a pointer and a length.
`
`@@ -881,7 +881,7 @@ pub const fn slice_from_raw_parts(data: *const T, len: usize) -> *const [T] {
`
881
881
`#[rustc_const_unstable(feature = "const_slice_from_raw_parts_mut", issue = "67456")]
`
882
882
`#[rustc_diagnostic_item = "ptr_slice_from_raw_parts_mut"]
`
883
883
`pub const fn slice_from_raw_parts_mut(data: *mut T, len: usize) -> *mut [T] {
`
884
``
`-
intrinsics::aggregate_raw_ptr(data, len)
`
``
884
`+
from_raw_parts_mut(data, len)
`
885
885
`}
`
886
886
``
887
887
`/// Swaps the values at two mutable locations of the same type, without
`