rust/library/core/src/str
Jubilee b496974c53
Rollup merge of #131520 - zachs18:const-str-split, r=Noratrieb
Mark `str::is_char_boundary` and `str::split_at*` unstably `const`.

Tracking issues: #131516, #131518

First commit implements `const_is_char_boundary`, second commit implements `const_str_split_at` (which depends on `const_is_char_boundary`)

~~I used `const_eval_select` for `is_char_boundary` since there is a comment about optimizations that would theoretically not happen with the simple `const`-compatible version (since `slice::get` is not `const`ifiable) cc #84751. I have not checked if this code difference is still required for the optimization, so it might not be worth the code complication, but 🤷.~~

This changes `str::split_at_checked` to use a new private helper function `split_at_unchecked` (copied from `split_at_mut_unchecked`) that does pointer stuff instead of `get_unchecked`, since that is not currently `const`ifiable due to using the `SliceIndex` trait.
2024-10-29 03:11:39 -07:00
..
converts.rs update bootstrap configs 2024-10-15 20:30:23 -07: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 Utf8Chunks: add link to Utf8Chunk 2024-09-25 19:46:41 +02:00
mod.rs Rollup merge of #131520 - zachs18:const-str-split, r=Noratrieb 2024-10-29 03:11:39 -07:00
pattern.rs library: consistently use American spelling for 'behavior' 2024-10-25 12:02:47 +02: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 Reformat use declarations. 2024-07-29 08:26:52 +10:00