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()`.
This commit is contained in:
@@ -1076,4 +1076,4 @@ impl Error for crate::time::TryFromFloatSecsError {}
|
||||
impl Error for crate::ffi::FromBytesUntilNulError {}
|
||||
|
||||
#[unstable(feature = "get_many_mut", issue = "104642")]
|
||||
impl<const N: usize> Error for crate::slice::GetManyMutError<N> {}
|
||||
impl Error for crate::slice::GetManyMutError {}
|
||||
|
||||
Reference in New Issue
Block a user