File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,26 @@ fn uninit_fill_from_partial() {
451451 assert_eq ! ( remainder. len( ) , 16 ) ;
452452}
453453
454+ #[ test]
455+ fn uninit_over_fill ( ) {
456+ let mut dst = [ MaybeUninit :: new ( 255 ) ; 64 ] ;
457+ let src = [ 0 ; 72 ] ;
458+
459+ let ( initted, remainder) = MaybeUninit :: fill_from ( & mut dst, src. into_iter ( ) ) ;
460+ assert_eq ! ( initted, & src[ 0 ..64 ] ) ;
461+ assert_eq ! ( remainder. len( ) , 0 ) ;
462+ }
463+
464+ #[ test]
465+ fn uninit_empty_fill ( ) {
466+ let mut dst = [ MaybeUninit :: new ( 255 ) ; 64 ] ;
467+ let src = [ 0 ; 0 ] ;
468+
469+ let ( initted, remainder) = MaybeUninit :: fill_from ( & mut dst, src. into_iter ( ) ) ;
470+ assert_eq ! ( initted, & src[ 0 ..0 ] ) ;
471+ assert_eq ! ( remainder. len( ) , 64 ) ;
472+ }
473+
454474#[ test]
455475#[ cfg( panic = "unwind" ) ]
456476fn uninit_fill_from_mid_panic ( ) {
You can’t perform that action at this time.
0 commit comments