File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 1111#![ feature( cfg_target_has_atomic) ]
1212#![ feature( const_assume) ]
1313#![ feature( const_cell_into_inner) ]
14+ #![ feature( const_maybe_uninit_assume_init) ]
1415#![ feature( core_intrinsics) ]
1516#![ feature( core_private_bignum) ]
1617#![ feature( core_private_diy_float) ]
5354#![ feature( const_pin) ]
5455#![ feature( const_slice_from_raw_parts) ]
5556#![ feature( const_raw_ptr_deref) ]
57+ #![ feature( const_assert_type) ]
5658#![ feature( never_type) ]
5759#![ feature( unwrap_infallible) ]
5860#![ feature( option_unwrap_none) ]
Original file line number Diff line number Diff line change @@ -132,18 +132,17 @@ fn test_discriminant_send_sync() {
132132
133133#[ test]
134134fn assume_init_good ( ) {
135- const TRUE : bool = unsafe {
136- let mut x = MaybeUninit :: < bool > :: uninit ( ) ;
137- x. as_mut_ptr ( ) . write ( true ) ;
138- x. assume_init ( )
139- } ;
135+ const TRUE : bool = unsafe { MaybeUninit :: < bool > :: new ( true ) . assume_init ( ) } ;
136+
140137 assert ! ( TRUE ) ;
141138}
142139
143140#[ test]
144- #[ should_panic]
145141fn assume_init_bad ( ) {
146- const BAD : ( ) = unsafe {
142+ const _BAD : ( ) = unsafe {
147143 MaybeUninit :: < !> :: uninit ( ) . assume_init ( ) ;
144+ //~^ ERROR the type `!` does not permit being left uninitialized
145+ //~| ERROR this code causes undefined behavior when executed
146+ //~| ERROR help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
148147 } ;
149148}
You can’t perform that action at this time.
0 commit comments