Skip to content

Commit 1585933

Browse files
authored
Rollup merge of #140511 - mathisbot:master, r=dtolnay
Stabilize `#![feature(non_null_from_ref)]` This PR stabilizes the following: ```rust impl<T: ?Sized> NonNull<T> { pub const fn from_ref(reference: &T) -> NonNull<T>; pub const fn from_mut(reference: &mut T) -> NonNull<T>; } ``` The feature is tracked in [#130823](#130823).
2 parents 5592f41 + e83a0a4 commit 1585933

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
#![feature(is_ascii_octdigit)]
112112
#![feature(lazy_get)]
113113
#![feature(link_cfg)]
114-
#![feature(non_null_from_ref)]
115114
#![feature(offset_of_enum)]
116115
#![feature(panic_internals)]
117116
#![feature(ptr_alignment_type)]

library/core/src/ptr/non_null.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,17 @@ impl<T: ?Sized> NonNull<T> {
262262
}
263263

264264
/// Converts a reference to a `NonNull` pointer.
265-
#[unstable(feature = "non_null_from_ref", issue = "130823")]
265+
#[stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
266+
#[rustc_const_stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
266267
#[inline]
267268
pub const fn from_ref(r: &T) -> Self {
268269
// SAFETY: A reference cannot be null.
269270
unsafe { NonNull { pointer: r as *const T } }
270271
}
271272

272273
/// Converts a mutable reference to a `NonNull` pointer.
273-
#[unstable(feature = "non_null_from_ref", issue = "130823")]
274+
#[stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
275+
#[rustc_const_stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
274276
#[inline]
275277
pub const fn from_mut(r: &mut T) -> Self {
276278
// SAFETY: A mutable reference cannot be null.

0 commit comments

Comments
 (0)