Skip to content

Commit

Permalink
Rollup merge of #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 authored May 3, 2023
2 parents 9c502da + 62e0c72 commit 91dfba3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/slice/mod.rs
Original file line number Diff line number Diff line change
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 91dfba3

Please sign in to comment.