File tree 2 files changed +21
-0
lines changed
2 files changed +21
-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
+ }
19
+
Original file line number Diff line number Diff line change 2
2
#![ feature( box_syntax) ]
3
3
#![ feature( drain_filter) ]
4
4
#![ feature( exact_size_is_empty) ]
5
+ #![ feature( new_uninit) ]
5
6
#![ feature( option_flattening) ]
6
7
#![ feature( pattern) ]
7
8
#![ feature( repeat_generic_slice) ]
@@ -15,6 +16,7 @@ use std::collections::hash_map::DefaultHasher;
15
16
16
17
mod arc;
17
18
mod binary_heap;
19
+ mod boxed;
18
20
mod btree;
19
21
mod cow_str;
20
22
mod fmt;
You can’t perform that action at this time.
0 commit comments