@@ -631,10 +631,6 @@ impl<T, const N: usize> [T; N] {
631
631
/// the index `M` itself) and the second will contain all
632
632
/// indices from `[M, N)` (excluding the index `N` itself).
633
633
///
634
- /// # Panics
635
- ///
636
- /// Panics if `M > N`.
637
- ///
638
634
/// # Examples
639
635
///
640
636
/// ```
@@ -667,6 +663,8 @@ impl<T, const N: usize> [T; N] {
667
663
) ]
668
664
#[ inline]
669
665
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 ) }
670
668
( & self [ ..] ) . split_array_ref :: < M > ( ) . unwrap ( )
671
669
}
672
670
@@ -676,10 +674,6 @@ impl<T, const N: usize> [T; N] {
676
674
/// the index `M` itself) and the second will contain all
677
675
/// indices from `[M, N)` (excluding the index `N` itself).
678
676
///
679
- /// # Panics
680
- ///
681
- /// Panics if `M > N`.
682
- ///
683
677
/// # Examples
684
678
///
685
679
/// ```
@@ -700,6 +694,8 @@ impl<T, const N: usize> [T; N] {
700
694
) ]
701
695
#[ inline]
702
696
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 ) }
703
699
( & mut self [ ..] ) . split_array_mut :: < M > ( ) . unwrap ( )
704
700
}
705
701
@@ -709,10 +705,6 @@ impl<T, const N: usize> [T; N] {
709
705
/// the index `N - M` itself) and the second will contain all
710
706
/// indices from `[N - M, N)` (excluding the index `N` itself).
711
707
///
712
- /// # Panics
713
- ///
714
- /// Panics if `M > N`.
715
- ///
716
708
/// # Examples
717
709
///
718
710
/// ```
@@ -745,6 +737,8 @@ impl<T, const N: usize> [T; N] {
745
737
) ]
746
738
#[ inline]
747
739
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 ) }
748
742
( & self [ ..] ) . rsplit_array_ref :: < M > ( ) . unwrap ( )
749
743
}
750
744
@@ -754,10 +748,6 @@ impl<T, const N: usize> [T; N] {
754
748
/// the index `N - M` itself) and the second will contain all
755
749
/// indices from `[N - M, N)` (excluding the index `N` itself).
756
750
///
757
- /// # Panics
758
- ///
759
- /// Panics if `M > N`.
760
- ///
761
751
/// # Examples
762
752
///
763
753
/// ```
@@ -778,6 +768,8 @@ impl<T, const N: usize> [T; N] {
778
768
) ]
779
769
#[ inline]
780
770
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 ) }
781
773
( & mut self [ ..] ) . rsplit_array_mut :: < M > ( ) . unwrap ( )
782
774
}
783
775
}
0 commit comments