Skip to content

Commit

Permalink
Unrolled build for rust-lang#127660
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#127660 - tgross35:const_strlen-rename, r=dtolnay

Rename the internal `const_strlen` to just `strlen`

Since the libs and lang teams completed an FCP to allow for const `strlen` ([1]), currently implemented with `const_eval_select`, there is no longer any reason to avoid this specific function or use it only in const.

Rename it to reflect this status change.

[1]: rust-lang#113219 (comment)
  • Loading branch information
rust-timer committed Jul 13, 2024
2 parents c6727fc + 2772f89 commit 1719909
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl CStr {
pub const unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
// SAFETY: The caller has provided a pointer that points to a valid C
// string with a NUL terminator less than `isize::MAX` from `ptr`.
let len = unsafe { const_strlen(ptr) };
let len = unsafe { strlen(ptr) };

// SAFETY: The caller has provided a valid pointer with length less than
// `isize::MAX`, so `from_raw_parts` is safe. The content remains valid
Expand Down Expand Up @@ -743,7 +743,7 @@ impl AsRef<CStr> for CStr {
#[unstable(feature = "cstr_internals", issue = "none")]
#[rustc_const_stable(feature = "const_cstr_from_ptr", since = "CURRENT_RUSTC_VERSION")]
#[rustc_allow_const_fn_unstable(const_eval_select)]
const unsafe fn const_strlen(ptr: *const c_char) -> usize {
const unsafe fn strlen(ptr: *const c_char) -> usize {
const fn strlen_ct(s: *const c_char) -> usize {
let mut len = 0;

Expand Down

0 comments on commit 1719909

Please sign in to comment.