File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 9
9
#[ macro_use]
10
10
mod zipmacro;
11
11
12
+ use std:: mem:: MaybeUninit ;
13
+
12
14
use crate :: imp_prelude:: * ;
13
15
use crate :: AssignElem ;
14
16
use crate :: IntoDimension ;
@@ -737,6 +739,12 @@ where
737
739
self . dimension [ unroll_axis] = inner_len;
738
740
FoldWhile :: Continue ( acc)
739
741
}
742
+
743
+ pub ( crate ) fn uninitalized_for_current_layout < T > ( & self ) -> Array < MaybeUninit < T > , D >
744
+ {
745
+ let is_f = !self . layout . is ( CORDER ) && self . layout . is ( FORDER ) ;
746
+ Array :: maybe_uninit ( self . dimension . clone ( ) . set_f ( is_f) )
747
+ }
740
748
}
741
749
742
750
/*
@@ -997,9 +1005,7 @@ macro_rules! map_impl {
997
1005
{
998
1006
// To support non-Copy elements, implementation of dropping partial array (on
999
1007
// panic) is needed
1000
- let is_c = self . layout. is( CORDER ) ;
1001
- let is_f = !is_c && self . layout. is( FORDER ) ;
1002
- let mut output = Array :: maybe_uninit( self . dimension. clone( ) . set_f( is_f) ) ;
1008
+ let mut output = self . uninitalized_for_current_layout:: <R >( ) ;
1003
1009
self . apply_assign_into( & mut output, f) ;
1004
1010
unsafe {
1005
1011
output. assume_init( )
You can’t perform that action at this time.
0 commit comments