File tree 2 files changed +4
-2
lines changed
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] {
372
372
///
373
373
/// # Examples
374
374
/// ```
375
+ /// #![feature(array_map)]
375
376
/// let x = [1,2,3];
376
377
/// let y = x.map(|v| v + 1);
377
378
/// assert_eq!(y, [2,3,4]);
@@ -402,8 +403,8 @@ impl<T, const N: usize> [T; N] {
402
403
}
403
404
let mut dst = MaybeUninit :: uninit_array :: < N > ( ) ;
404
405
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 ) ) ;
407
408
guard. curr_init += 1 ;
408
409
}
409
410
// FIXME convert to crate::mem::transmute when works with generics
Original file line number Diff line number Diff line change 145
145
#![ feature( abi_unadjusted) ]
146
146
#![ feature( adx_target_feature) ]
147
147
#![ feature( maybe_uninit_slice) ]
148
+ #![ feature( maybe_uninit_extra) ]
148
149
#![ feature( external_doc) ]
149
150
#![ feature( associated_type_bounds) ]
150
151
#![ feature( const_caller_location) ]
You can’t perform that action at this time.
0 commit comments