rust/library/core/src/slice
Michael Goulet 42459a7971
Rollup merge of #133136 - ChayimFriedman2:get-many-mut, r=Amanieu
Support ranges in `<[T]>::get_many_mut()`

As per T-libs-api decision in #104642.

I implemented that with a separate trait and not within `SliceIndex`, because doing that via `SliceIndex` requires adding support for range types that are (almost) always overlapping e.g. `RangeFrom`, and also adding fake support code for `impl SliceIndex<str>`.

An inconvenience that I ran into was that slice indexing takes the index by value, but I only have it by reference. I could change slice indexing to take by ref, but this is pretty much the hottest code ever so I'm afraid to touch it. Instead I added a requirement for `Clone` (which all index types implement anyway) and cloned. This is an internal requirement the user won't see and the clone should always be optimized away.

I also implemented `Clone`, `PartialEq` and `Eq` for the error type, since I noticed it does not do that when writing the tests and other errors in std seem to implement them. I didn't implement `Copy` because maybe we will want to put something non-`Copy` there.
2024-11-26 12:03:40 -05:00
..
iter Use &raw in the standard library 2024-09-25 17:03:20 -07:00
sort Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
ascii.rs Add new unstable feature const_eq_ignore_ascii_case 2024-11-05 22:22:31 -05:00
cmp.rs vectorized SliceContains 2024-10-23 20:14:17 +02:00
index.rs add const_eval_select macro to reduce redundancy 2024-11-05 09:26:08 +01:00
iter.rs Use &raw in the standard library 2024-09-25 17:03:20 -07:00
memchr.rs add const_eval_select macro to reduce redundancy 2024-11-05 09:26:08 +01:00
mod.rs Rollup merge of #133136 - ChayimFriedman2:get-many-mut, r=Amanieu 2024-11-26 12:03:40 -05:00
raw.rs clean up const stability around UB checks 2024-11-16 22:50:22 +01:00
rotate.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
specialize.rs Remove size_of == 1 case from fill specialization. 2021-08-09 19:25:28 +02:00