Tag relevant functions with #[rustc_as_ptr] attribute

This commit is contained in:
gavincrawford
2024-11-05 10:05:56 -07:00
parent 37c30aeb45
commit fdef65bf6e
7 changed files with 15 additions and 0 deletions

View File

@@ -735,6 +735,7 @@ impl<T> [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0")]
#[rustc_never_returns_null_ptr]
#[cfg_attr(not(bootstrap), rustc_as_ptr)]
#[inline(always)]
#[must_use]
pub const fn as_ptr(&self) -> *const T {
@@ -766,6 +767,7 @@ impl<T> [T] {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[rustc_allow_const_fn_unstable(const_mut_refs)]
#[rustc_never_returns_null_ptr]
#[cfg_attr(not(bootstrap), rustc_as_ptr)]
#[inline(always)]
#[must_use]
pub const fn as_mut_ptr(&mut self) -> *mut T {