Rollup merge of #132895 - scottmcm:generalize-nonnull-from-raw-parts, r=ibraheemdev

Generalize `NonNull::from_raw_parts` per ACP362

I did the raw pointers in #125701, but apparently forgot `NonNull`.

cc https://github.com/rust-lang/libs-team/issues/362
This commit is contained in:
Matthias Krüger 2024-11-12 08:07:17 +01:00 committed by GitHub
commit 72c62688d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -251,7 +251,7 @@ impl<T: ?Sized> NonNull<T> {
#[unstable(feature = "ptr_metadata", issue = "81513")]
#[inline]
pub const fn from_raw_parts(
data_pointer: NonNull<()>,
data_pointer: NonNull<impl super::Thin>,
metadata: <T as super::Pointee>::Metadata,
) -> NonNull<T> {
// SAFETY: The result of `ptr::from::raw_parts_mut` is non-null because `data_pointer` is.