Make slice::as_flattened_mut unstably const
Tracking issue: https://github.com/rust-lang/rust/issues/95629 Unblocked by const_mut_refs being stabilized: https://github.com/rust-lang/rust/pull/129195
This commit is contained in:
parent
f95c996750
commit
26f523edfc
1 changed files with 2 additions and 1 deletions
|
|
@ -4821,7 +4821,8 @@ impl<T, const N: usize> [[T; N]] {
|
|||
/// assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]);
|
||||
/// ```
|
||||
#[stable(feature = "slice_flatten", since = "1.80.0")]
|
||||
pub fn as_flattened_mut(&mut self) -> &mut [T] {
|
||||
#[rustc_const_unstable(feature = "const_slice_flatten", issue = "95629")]
|
||||
pub const fn as_flattened_mut(&mut self) -> &mut [T] {
|
||||
let len = if T::IS_ZST {
|
||||
self.len().checked_mul(N).expect("slice len overflow")
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue