Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cac6664

Browse files
committedJul 12, 2024
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)
1 parent 0476fc4 commit cac6664

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎core/src/ffi/c_str.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl CStr {
282282
pub const unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
283283
// SAFETY: The caller has provided a pointer that points to a valid C
284284
// string with a NUL terminator less than `isize::MAX` from `ptr`.
285-
let len = unsafe { const_strlen(ptr) };
285+
let len = unsafe { strlen(ptr) };
286286

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

0 commit comments

Comments
 (0)
Failed to load comments.