File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,7 @@ impl<T, const N: usize> [T; N] {
372372 ///
373373 /// # Examples
374374 /// ```
375+ /// #![feature(array_map)]
375376 /// let x = [1,2,3];
376377 /// let y = x.map(|v| v + 1);
377378 /// assert_eq!(y, [2,3,4]);
@@ -402,8 +403,8 @@ impl<T, const N: usize> [T; N] {
402403 }
403404 let mut dst = MaybeUninit :: uninit_array :: < N > ( ) ;
404405 let mut guard: Guard < S , N > = Guard { dst : & mut dst as * mut _ as * mut S , curr_init : 0 } ;
405- for ( i , e ) in IntoIter :: new ( self ) . enumerate ( ) {
406- dst[ i ] = MaybeUninit :: new ( f ( e ) ) ;
406+ for ( src , dst ) in IntoIter :: new ( self ) . zip ( & mut dst ) {
407+ dst. write ( f ( src ) ) ;
407408 guard. curr_init += 1 ;
408409 }
409410 // FIXME convert to crate::mem::transmute when works with generics
Original file line number Diff line number Diff line change 145145#![ feature( abi_unadjusted) ]
146146#![ feature( adx_target_feature) ]
147147#![ feature( maybe_uninit_slice) ]
148+ #![ feature( maybe_uninit_extra) ]
148149#![ feature( external_doc) ]
149150#![ feature( associated_type_bounds) ]
150151#![ feature( const_caller_location) ]
You can’t perform that action at this time.
0 commit comments