Skip to content

Stabilize const_is_char_boundary and const_str_split_at. #134016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl str {
/// ```
#[must_use]
#[stable(feature = "is_char_boundary", since = "1.9.0")]
#[rustc_const_unstable(feature = "const_is_char_boundary", issue = "131516")]
#[rustc_const_stable(feature = "const_is_char_boundary", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub const fn is_char_boundary(&self, index: usize) -> bool {
// 0 is always ok.
Expand Down Expand Up @@ -642,7 +642,7 @@ impl str {
#[inline]
#[must_use]
#[stable(feature = "str_split_at", since = "1.4.0")]
#[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")]
#[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")]
pub const fn split_at(&self, mid: usize) -> (&str, &str) {
match self.split_at_checked(mid) {
None => slice_error_fail(self, 0, mid),
Expand Down Expand Up @@ -683,7 +683,7 @@ impl str {
#[inline]
#[must_use]
#[stable(feature = "str_split_at", since = "1.4.0")]
#[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")]
#[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")]
pub const fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) {
// is_char_boundary checks that the index is in [0, .len()]
if self.is_char_boundary(mid) {
Expand Down Expand Up @@ -723,7 +723,7 @@ impl str {
#[inline]
#[must_use]
#[stable(feature = "split_at_checked", since = "1.80.0")]
#[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")]
#[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")]
pub const fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)> {
// is_char_boundary checks that the index is in [0, .len()]
if self.is_char_boundary(mid) {
Expand Down Expand Up @@ -764,7 +764,7 @@ impl str {
#[inline]
#[must_use]
#[stable(feature = "split_at_checked", since = "1.80.0")]
#[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")]
#[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")]
pub const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut str, &mut str)> {
// is_char_boundary checks that the index is in [0, .len()]
if self.is_char_boundary(mid) {
Expand Down
Loading