Stabilize round_char_boundary feature

This commit is contained in:
okaneco 2025-08-22 11:58:36 -04:00
parent f5703d5dd3
commit e42c1b1296
10 changed files with 22 additions and 26 deletions

View file

@ -29,6 +29,7 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(round_char_boundary))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(allocator_api)]
@ -51,7 +52,6 @@
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(ptr_alignment_type)]
#![feature(round_char_boundary)]
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
#![feature(sized_hierarchy)]

View file

@ -17,6 +17,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(round_char_boundary))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(array_windows)]
@ -26,7 +27,6 @@
#![feature(map_try_insert)]
#![feature(negative_impls)]
#![feature(read_buf)]
#![feature(round_char_boundary)]
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
// tidy-alphabetical-end

View file

@ -23,7 +23,6 @@
#![feature(inplace_iteration)]
#![feature(iter_advance_by)]
#![feature(iter_next_chunk)]
#![feature(round_char_boundary)]
#![feature(slice_partition_dedup)]
#![feature(string_from_utf8_lossy_owned)]
#![feature(string_remove_matches)]

View file

@ -396,7 +396,6 @@ impl str {
/// # Examples
///
/// ```
/// #![feature(round_char_boundary)]
/// let s = "❤️🧡💛💚💙💜";
/// assert_eq!(s.len(), 26);
/// assert!(!s.is_char_boundary(13));
@ -405,7 +404,8 @@ impl str {
/// assert_eq!(closest, 10);
/// assert_eq!(&s[..closest], "❤️🧡");
/// ```
#[unstable(feature = "round_char_boundary", issue = "93743")]
#[stable(feature = "round_char_boundary", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "round_char_boundary", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub const fn floor_char_boundary(&self, index: usize) -> usize {
if index >= self.len() {
@ -439,7 +439,6 @@ impl str {
/// # Examples
///
/// ```
/// #![feature(round_char_boundary)]
/// let s = "❤️🧡💛💚💙💜";
/// assert_eq!(s.len(), 26);
/// assert!(!s.is_char_boundary(13));
@ -448,7 +447,8 @@ impl str {
/// assert_eq!(closest, 14);
/// assert_eq!(&s[..closest], "❤️🧡💛");
/// ```
#[unstable(feature = "round_char_boundary", issue = "93743")]
#[stable(feature = "round_char_boundary", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "round_char_boundary", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub const fn ceil_char_boundary(&self, index: usize) -> usize {
if index >= self.len() {

View file

@ -263,7 +263,6 @@
all(target_vendor = "fortanix", target_env = "sgx"),
feature(slice_index_methods, coerce_unsized, sgx_platform)
)]
#![cfg_attr(any(windows, target_os = "uefi"), feature(round_char_boundary))]
#![cfg_attr(target_family = "wasm", feature(stdarch_wasm_atomic_wait))]
#![cfg_attr(target_arch = "wasm64", feature(simd_wasm64))]
//

View file

@ -1,4 +1,5 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(round_char_boundary))]
#![doc(
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/"
@ -12,7 +13,6 @@
#![feature(format_args_nl)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
#![feature(round_char_boundary)]
#![feature(rustc_private)]
#![feature(test)]
#![warn(rustc::internal)]

View file

@ -7,7 +7,7 @@
#![feature(iter_intersperse)]
#![feature(iter_partition_in_place)]
#![feature(never_type)]
#![feature(round_char_boundary)]
#![cfg_attr(bootstrap, feature(round_char_boundary))]
#![feature(rustc_private)]
#![feature(stmt_expr_attributes)]
#![feature(unwrap_infallible)]

View file

@ -1,4 +1,3 @@
#![feature(round_char_boundary)]
#![warn(clippy::char_indices_as_byte_indices)]
trait StrExt {

View file

@ -1,4 +1,3 @@
#![feature(round_char_boundary)]
#![warn(clippy::char_indices_as_byte_indices)]
trait StrExt {

View file

@ -1,12 +1,12 @@
error: indexing into a string with a character position where a byte index is expected
--> tests/ui/char_indices_as_byte_indices.rs:13:24
--> tests/ui/char_indices_as_byte_indices.rs:12:24
|
LL | let _ = prim[..idx];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:12:10
--> tests/ui/char_indices_as_byte_indices.rs:11:10
|
LL | for (idx, _) in prim.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
@ -19,14 +19,14 @@ LL + for (idx, _) in prim.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:15:23
--> tests/ui/char_indices_as_byte_indices.rs:14:23
|
LL | prim.split_at(idx);
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:12:10
--> tests/ui/char_indices_as_byte_indices.rs:11:10
|
LL | for (idx, _) in prim.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
@ -37,14 +37,14 @@ LL + for (idx, _) in prim.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:19:49
--> tests/ui/char_indices_as_byte_indices.rs:18:49
|
LL | let _ = prim[..prim.floor_char_boundary(idx)];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:12:10
--> tests/ui/char_indices_as_byte_indices.rs:11:10
|
LL | for (idx, _) in prim.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
@ -55,14 +55,14 @@ LL + for (idx, _) in prim.char_indices() {
|
error: indexing into a string with a character position where a byte index is expected
--> tests/ui/char_indices_as_byte_indices.rs:29:24
--> tests/ui/char_indices_as_byte_indices.rs:28:24
|
LL | let _ = prim[..c.0];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:28:9
--> tests/ui/char_indices_as_byte_indices.rs:27:9
|
LL | for c in prim.chars().enumerate() {
| ^ ^^^^^^^^^^^
@ -73,14 +73,14 @@ LL + for c in prim.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:31:23
--> tests/ui/char_indices_as_byte_indices.rs:30:23
|
LL | prim.split_at(c.0);
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:28:9
--> tests/ui/char_indices_as_byte_indices.rs:27:9
|
LL | for c in prim.chars().enumerate() {
| ^ ^^^^^^^^^^^
@ -91,14 +91,14 @@ LL + for c in prim.char_indices() {
|
error: indexing into a string with a character position where a byte index is expected
--> tests/ui/char_indices_as_byte_indices.rs:36:26
--> tests/ui/char_indices_as_byte_indices.rs:35:26
|
LL | let _ = string[..idx];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:35:10
--> tests/ui/char_indices_as_byte_indices.rs:34:10
|
LL | for (idx, _) in string.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
@ -109,14 +109,14 @@ LL + for (idx, _) in string.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:38:25
--> tests/ui/char_indices_as_byte_indices.rs:37:25
|
LL | string.split_at(idx);
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:35:10
--> tests/ui/char_indices_as_byte_indices.rs:34:10
|
LL | for (idx, _) in string.chars().enumerate() {
| ^^^ ^^^^^^^^^^^