diff options
| author | Chayim Refael Friedman <chayimfr@gmail.com> | 2024-11-28 23:34:47 +0200 |
|---|---|---|
| committer | Chayim Refael Friedman <chayimfr@gmail.com> | 2024-11-28 23:34:47 +0200 |
| commit | fa87a3e88942e407a2214728bb466620f538d13d (patch) | |
| tree | 281053032580490caede6c4b2dbe9a8ee6000992 /library/alloc/src/slice.rs | |
| parent | 7e565cce6a03340edb4b9f56228cf5e480e24806 (diff) | |
| download | rust-fa87a3e88942e407a2214728bb466620f538d13d.tar.gz rust-fa87a3e88942e407a2214728bb466620f538d13d.zip | |
Change `GetManyMutError` to match T-libs-api decision
That is, differentiate between out-of-bounds and overlapping indices, and remove the generic parameter `N`. I also exported `GetManyMutError` from `alloc` (and `std`), which was apparently forgotten. Changing the error to carry additional details means LLVM no longer generates separate short-circuiting branches for the checks, instead it generates one branch at the end. I therefore changed the code to use early returns to make LLVM generate jumps. Benchmark results between the approaches are somewhat mixed, but I chose this approach because it is significantly faster with ranges and also faster with `unwrap()`.
Diffstat (limited to 'library/alloc/src/slice.rs')
| -rw-r--r-- | library/alloc/src/slice.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs index e3c7835f1d1..edc8d99f2f9 100644 --- a/library/alloc/src/slice.rs +++ b/library/alloc/src/slice.rs @@ -27,6 +27,8 @@ pub use core::slice::ArrayChunksMut; pub use core::slice::ArrayWindows; #[stable(feature = "inherent_ascii_escape", since = "1.60.0")] pub use core::slice::EscapeAscii; +#[unstable(feature = "get_many_mut", issue = "104642")] +pub use core::slice::GetManyMutError; #[stable(feature = "slice_get_slice", since = "1.28.0")] pub use core::slice::SliceIndex; #[cfg(not(no_global_oom_handling))] |
