move const fn with a null check into const_ptr_is_null gate · qinheping/verify-rust-std@41cd571 (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -268,7 +268,7 @@ impl<T: ?Sized> *const T {
268 268 /// }
269 269 /// ```
270 270 #[stable(feature = "ptr_as_ref", since = "1.9.0")]
271 -#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
271 +#[rustc_const_unstable(feature = "const_ptr_is_null", issue = "74939")]
272 272 #[inline]
273 273 pub const unsafe fn as_ref<'a>(self) -> Option<&'a T> {
274 274 // SAFETY: the caller must guarantee that `self` is valid
Original file line number Diff line number Diff line change
@@ -276,7 +276,7 @@ impl<T: ?Sized> *mut T {
276 276 /// }
277 277 /// ```
278 278 #[stable(feature = "ptr_as_ref", since = "1.9.0")]
279 -#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
279 +#[rustc_const_unstable(feature = "const_ptr_is_null", issue = "74939")]
280 280 #[inline]
281 281 pub const unsafe fn as_ref<'a>(self) -> Option<&'a T> {
282 282 // SAFETY: the caller must guarantee that `self` is valid for a
@@ -595,7 +595,7 @@ impl<T: ?Sized> *mut T {
595 595 /// println!("{s:?}"); // It'll print: "[4, 2, 3]".
596 596 /// ```
597 597 #[stable(feature = "ptr_as_ref", since = "1.9.0")]
598 -#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
598 +#[rustc_const_unstable(feature = "const_ptr_is_null", issue = "74939")]
599 599 #[inline]
600 600 pub const unsafe fn as_mut<'a>(self) -> Option<&'a mut T> {
601 601 // SAFETY: the caller must guarantee that `self` is be valid for