about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/Linker.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-10-23 05:28:19 +0200
committerGitHub <noreply@github.com>2021-10-23 05:28:19 +0200
commit5ea02745637be7c4c0c8ba46407bbfca3b66edcc (patch)
tree991afed0745bc8e2f1816060d8d820c819975f32 /compiler/rustc_llvm/llvm-wrapper/Linker.cpp
parent514b3877956dc594823106b66c164f8cdbc8b3da (diff)
parent4a439769ecd292106d62270d171568ac7aa0164b (diff)
downloadrust-5ea02745637be7c4c0c8ba46407bbfca3b66edcc.tar.gz
rust-5ea02745637be7c4c0c8ba46407bbfca3b66edcc.zip
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/Linker.cpp')
0 files changed, 0 insertions, 0 deletions