Rollup merge of #127433 - dtolnay:conststrlen, r=workingjubilee · model-checking/verify-rust-std@0476fc4

@@ -263,8 +263,6 @@ impl CStr {

263263

/// ```

264264

///

265265

/// ```

266-

/// #![feature(const_cstr_from_ptr)]

267-

///

268266

/// use std::ffi::{c_char, CStr};

269267

///

270268

/// const HELLO_PTR: *const c_char = {

@@ -280,7 +278,7 @@ impl CStr {

280278

#[inline] // inline is necessary for codegen to see strlen.

281279

#[must_use]

282280

#[stable(feature = "rust1", since = "1.0.0")]

283-

#[rustc_const_unstable(feature = "const_cstr_from_ptr", issue = "113219")]

281+

#[rustc_const_stable(feature = "const_cstr_from_ptr", since = "CURRENT_RUSTC_VERSION")]

284282

pub const unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {

285283

// SAFETY: The caller has provided a pointer that points to a valid C

286284

// string with a NUL terminator less than `isize::MAX` from `ptr`.

@@ -542,7 +540,7 @@ impl CStr {

542540

#[must_use]

543541

#[doc(alias("len", "strlen"))]

544542

#[stable(feature = "cstr_count_bytes", since = "1.79.0")]

545-

#[rustc_const_unstable(feature = "const_cstr_from_ptr", issue = "113219")]

543+

#[rustc_const_stable(feature = "const_cstr_from_ptr", since = "CURRENT_RUSTC_VERSION")]

546544

pub const fn count_bytes(&self) -> usize {

547545

self.inner.len() - 1

548546

}

@@ -742,6 +740,9 @@ impl AsRef<CStr> for CStr {

742740

/// The pointer must point to a valid buffer that contains a NUL terminator. The NUL must be

743741

/// located within `isize::MAX` from `ptr`.

744742

#[inline]

743+

#[unstable(feature = "cstr_internals", issue = "none")]

744+

#[rustc_const_stable(feature = "const_cstr_from_ptr", since = "CURRENT_RUSTC_VERSION")]

745+

#[rustc_allow_const_fn_unstable(const_eval_select)]

745746

const unsafe fn const_strlen(ptr: *const c_char) -> usize {

746747

const fn strlen_ct(s: *const c_char) -> usize {

747748

let mut len = 0;