Skip to content

Commit

Permalink
Rollup merge of rust-lang#111127 - xfix:const-slice-flatten, r=scottmcm
Browse files Browse the repository at this point in the history
Constify slice flatten method

ACP: rust-lang/libs-team#218
  • Loading branch information
Manishearth committed May 3, 2023
2 parents 93acb8b + 4fec8a3 commit 1b255c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/slice/mod.rs
Expand Up @@ -4257,7 +4257,7 @@ impl<T, const N: usize> [[T; N]] {
/// assert!(empty_slice_of_arrays.flatten().is_empty());
/// ```
#[unstable(feature = "slice_flatten", issue = "95629")]
pub fn flatten(&self) -> &[T] {
pub const fn flatten(&self) -> &[T] {
let len = if T::IS_ZST {
self.len().checked_mul(N).expect("slice len overflow")
} else {
Expand Down

0 comments on commit 1b255c8

Please sign in to comment.