@@ -631,10 +631,6 @@ impl<T, const N: usize> [T; N] {
631631 /// the index `M` itself) and the second will contain all
632632 /// indices from `[M, N)` (excluding the index `N` itself).
633633 ///
634- /// # Panics
635- ///
636- /// Panics if `M > N`.
637- ///
638634 /// # Examples
639635 ///
640636 /// ```
@@ -667,6 +663,8 @@ impl<T, const N: usize> [T; N] {
667663 ) ]
668664 #[ inline]
669665 pub fn split_array_ref < const M : usize > ( & self ) -> ( & [ T ; M ] , & [ T ] ) {
666+ // FIXME: remove once constraint is encoded in return type
667+ const { assert ! ( M <= N ) }
670668 ( & self [ ..] ) . split_array_ref :: < M > ( ) . unwrap ( )
671669 }
672670
@@ -676,10 +674,6 @@ impl<T, const N: usize> [T; N] {
676674 /// the index `M` itself) and the second will contain all
677675 /// indices from `[M, N)` (excluding the index `N` itself).
678676 ///
679- /// # Panics
680- ///
681- /// Panics if `M > N`.
682- ///
683677 /// # Examples
684678 ///
685679 /// ```
@@ -700,6 +694,8 @@ impl<T, const N: usize> [T; N] {
700694 ) ]
701695 #[ inline]
702696 pub fn split_array_mut < const M : usize > ( & mut self ) -> ( & mut [ T ; M ] , & mut [ T ] ) {
697+ // FIXME: remove once constraint is encoded in return type
698+ const { assert ! ( M <= N ) }
703699 ( & mut self [ ..] ) . split_array_mut :: < M > ( ) . unwrap ( )
704700 }
705701
@@ -709,10 +705,6 @@ impl<T, const N: usize> [T; N] {
709705 /// the index `N - M` itself) and the second will contain all
710706 /// indices from `[N - M, N)` (excluding the index `N` itself).
711707 ///
712- /// # Panics
713- ///
714- /// Panics if `M > N`.
715- ///
716708 /// # Examples
717709 ///
718710 /// ```
@@ -745,6 +737,8 @@ impl<T, const N: usize> [T; N] {
745737 ) ]
746738 #[ inline]
747739 pub fn rsplit_array_ref < const M : usize > ( & self ) -> ( & [ T ] , & [ T ; M ] ) {
740+ // FIXME: remove once constraint is encoded in return type
741+ const { assert ! ( M <= N ) }
748742 ( & self [ ..] ) . rsplit_array_ref :: < M > ( ) . unwrap ( )
749743 }
750744
@@ -754,10 +748,6 @@ impl<T, const N: usize> [T; N] {
754748 /// the index `N - M` itself) and the second will contain all
755749 /// indices from `[N - M, N)` (excluding the index `N` itself).
756750 ///
757- /// # Panics
758- ///
759- /// Panics if `M > N`.
760- ///
761751 /// # Examples
762752 ///
763753 /// ```
@@ -778,6 +768,8 @@ impl<T, const N: usize> [T; N] {
778768 ) ]
779769 #[ inline]
780770 pub fn rsplit_array_mut < const M : usize > ( & mut self ) -> ( & mut [ T ] , & mut [ T ; M ] ) {
771+ // FIXME: remove once constraint is encoded in return type
772+ const { assert ! ( M <= N ) }
781773 ( & mut self [ ..] ) . rsplit_array_mut :: < M > ( ) . unwrap ( )
782774 }
783775}
0 commit comments