rust/library/core/tests
Matthias Krüger 5ea0274563
Rollup merge of #83233 - jethrogb:split_array, r=yaahc
Implement split_array and split_array_mut

This implements `[T]::split_array::<const N>() -> (&[T; N], &[T])` and `[T; N]::split_array::<const M>() -> (&[T; M], &[T])` and their mutable equivalents. These are another few “missing” array implementations now that const generics are a thing, similar to #74373, #75026, etc. Fixes #74674.

This implements `[T; N]::split_array` returning an array and a slice. Ultimately, this is probably not what we want, we would want the second return value to be an array of length N-M, which will likely be possible with future const generics enhancements. We need to implement the array method now though, to immediately shadow the slice method. This way, when the slice methods get stabilized, calling them on an array will not be automatic through coercion, so we won't have trouble stabilizing the array methods later (cf. into_iter debacle).

An unchecked version of `[T]::split_array` could also be added as in #76014. This would not be needed for `[T; N]::split_array` as that can be compile-time checked. Edit: actually, since split_at_unchecked is internal-only it could be changed to be split_array-only.
2021-10-23 05:28:19 +02:00
..
fmt Rollup merge of #86479 - exphp-forks:float-debug-exponential, r=yaahc 2021-10-20 04:35:10 +09:00
hash move object safety test to library/core 2021-08-15 13:00:25 -04:00
iter implement advance_(back_)_by on more iterators 2021-09-30 21:23:28 +02:00
num Auto merge of #88788 - falk-hueffner:speedup-int-log10-branchless, r=joshtriplett 2021-10-12 03:18:54 +00:00
ops Expand the docs for ops::ControlFlow a bit 2021-02-06 22:36:05 -08:00
alloc.rs
any.rs Add test for issue 84666. 2021-06-03 16:13:45 +02:00
array.rs Implement split_array and split_array_mut 2021-10-22 09:58:24 +02:00
ascii.rs
atomic.rs Make more From impls const 2021-10-18 19:19:28 +09:00
bool.rs
cell.rs Make more From impls const 2021-10-18 19:19:28 +09:00
char.rs Make more From impls const 2021-10-18 19:19:28 +09:00
clone.rs Fix borrow and deref 2021-03-03 11:23:29 +01:00
cmp.rs
const_ptr.rs Revert "Revert tests added by PR 81167." 2021-06-27 12:05:17 +02:00
intrinsics.rs
lazy.rs Make more From impls const 2021-10-18 19:19:28 +09:00
lib.rs Implement split_array and split_array_mut 2021-10-22 09:58:24 +02:00
macros.rs Allow leading pipe in matches!() patterns. 2021-07-15 22:05:45 +03:00
manually_drop.rs Test ManuallyDrop::clone_from. 2021-07-05 11:55:45 +00:00
mem.rs Remove the deprecated core::raw and std::raw module. 2021-07-03 14:03:27 +08:00
nonzero.rs Make From impls of NonZero integer const. 2021-10-20 12:04:58 +09:00
ops.rs Expand the docs for ops::ControlFlow a bit 2021-02-06 22:36:05 -08:00
option.rs Make more From impls const 2021-10-18 19:19:28 +09:00
pattern.rs
pin.rs
ptr.rs Bump cfgs 2021-04-04 14:57:05 -04:00
result.rs Make Result::as_mut const 2021-10-17 18:39:54 +09:00
slice.rs Implement split_array and split_array_mut 2021-10-22 09:58:24 +02:00
str.rs
str_lossy.rs
task.rs
time.rs Make Duration's Debug format pad to width 2021-09-16 03:09:31 +02:00
tuple.rs
unicode.rs