File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ use std:: ptr:: NonNull ;
2+ use std:: mem:: MaybeUninit ;
3+
4+ #[ test]
5+ fn unitialized_zero_size_box ( ) {
6+ assert_eq ! (
7+ & * Box :: <( ) >:: new_uninit( ) as * const _,
8+ NonNull :: <MaybeUninit <( ) >>:: dangling( ) . as_ptr( ) ,
9+ ) ;
10+ assert_eq ! (
11+ Box :: <[ ( ) ] >:: new_uninit_slice( 4 ) . as_ptr( ) ,
12+ NonNull :: <MaybeUninit <( ) >>:: dangling( ) . as_ptr( ) ,
13+ ) ;
14+ assert_eq ! (
15+ Box :: <[ String ] >:: new_uninit_slice( 0 ) . as_ptr( ) ,
16+ NonNull :: <MaybeUninit <String >>:: dangling( ) . as_ptr( ) ,
17+ ) ;
18+ }
Original file line number Diff line number Diff line change 22#![ feature( box_syntax) ]
33#![ feature( drain_filter) ]
44#![ feature( exact_size_is_empty) ]
5+ #![ feature( new_uninit) ]
56#![ feature( option_flattening) ]
67#![ feature( pattern) ]
78#![ feature( repeat_generic_slice) ]
@@ -15,6 +16,7 @@ use std::collections::hash_map::DefaultHasher;
1516
1617mod arc;
1718mod binary_heap;
19+ mod boxed;
1820mod btree;
1921mod cow_str;
2022mod fmt;
You can’t perform that action at this time.
0 commit comments