mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Stabilize ptr_const_cast
This stabilizes `ptr_const_cast` feature as was decided in a recent [FCP](https://github.com/rust-lang/rust/issues/92675#issuecomment-1190660233) Closes #92675
This commit is contained in:
parent
affe0d3a00
commit
2a3ce7890c
@ -19,7 +19,6 @@
|
||||
#![feature(rustc_attrs)]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
#![feature(strict_provenance)]
|
||||
#![feature(ptr_const_cast)]
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -95,8 +95,8 @@ impl<T: ?Sized> *const T {
|
||||
///
|
||||
/// This is a bit safer than `as` because it wouldn't silently change the type if the code is
|
||||
/// refactored.
|
||||
#[unstable(feature = "ptr_const_cast", issue = "92675")]
|
||||
#[rustc_const_unstable(feature = "ptr_const_cast", issue = "92675")]
|
||||
#[stable(feature = "ptr_const_cast", since = "1.65.0")]
|
||||
#[rustc_const_stable(feature = "ptr_const_cast", since = "1.65.0")]
|
||||
pub const fn cast_mut(self) -> *mut T {
|
||||
self as _
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// coercion.
|
||||
///
|
||||
/// [`cast_mut`]: #method.cast_mut
|
||||
#[unstable(feature = "ptr_const_cast", issue = "92675")]
|
||||
#[rustc_const_unstable(feature = "ptr_const_cast", issue = "92675")]
|
||||
#[stable(feature = "ptr_const_cast", since = "1.65.0")]
|
||||
#[rustc_const_stable(feature = "ptr_const_cast", since = "1.65.0")]
|
||||
pub const fn cast_const(self) -> *const T {
|
||||
self as _
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user