rust/library/core/src/str
Jubilee 58e84ff2b5
Rollup merge of #134016 - zachs18:stable-const-str-split_at, r=Amanieu
Stabilize `const_is_char_boundary` and `const_str_split_at`.

Tracking issues: #131516, #131518

Stabilized const API:

```rs
// in `core`
impl str {
    // const_is_char_boundary feature
    const fn is_char_boundary(&self, index: usize) -> bool;

    // const_str_split_at feature, depends on const_is_char_boundary
    const fn split_at(&self, mid: usize) -> (&str, &str);
    const fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str);
    const fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)>;
    const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut str, &mut str)>;
}
```

This will allow safely splitting string slices during const-eval.

Closes #131516, Closes #131518

This will need FCP.
r? libs-api

IIUC these do not use any new const language features (i.e. they are implementable manually on stable 1.83.0 using `unsafe`: [playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3679632cd1041084796241b7ac8edfbd)).

Cc ``@rust-lang/wg-const-eval`` (I don't know if I have the permissions for this ping; if not, someone else please ping wg-const-eval if it is necessary)
2025-02-14 14:05:22 -08:00
..
converts.rs Less unwrap() in documentation 2024-12-21 01:26:47 +00:00
count.rs Add blank lines after module-level //! comments. 2024-06-20 09:23:20 +10:00
error.rs add FIXME(const-hack) 2024-09-08 23:08:40 +02:00
iter.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
lossy.rs chore: fix typos 2024-12-24 23:37:30 +08:00
mod.rs Rollup merge of #134016 - zachs18:stable-const-str-split_at, r=Amanieu 2025-02-14 14:05:22 -08:00
pattern.rs Improve example of impl Pattern for &[char] 2024-11-04 19:08:28 +01:00
traits.rs remove const_slice_index annotations, it never had a feature gate anyway 2024-09-08 23:08:43 +02:00
validations.rs add const_eval_select macro to reduce redundancy 2024-11-05 09:26:08 +01:00