@@ -28,7 +28,7 @@ fn test_clone_to_uninit_slice_success() {
2828
2929let mut storage: MaybeUninit < [ String ; 3 ] > = MaybeUninit :: uninit ( ) ;
3030let b: [ String ; 3 ] = unsafe {
31- a[ ..] . clone_to_uninit ( storage. as_mut_ptr ( ) as * mut [ String ] ) ;
31+ a[ ..] . clone_to_uninit ( storage. as_mut_ptr ( ) . cast ( ) ) ;
3232 storage. assume_init ( )
3333} ;
3434
@@ -70,7 +70,7 @@ fn test_clone_to_uninit_slice_drops_on_panic() {
7070let mut storage: MaybeUninit < [ CountsDropsAndPanics ; 3 ] > = MaybeUninit :: uninit ( ) ;
7171// This should panic halfway through
7272unsafe {
73- a[ ..] . clone_to_uninit ( storage. as_mut_ptr ( ) as * mut [ CountsDropsAndPanics ] ) ;
73+ a[ ..] . clone_to_uninit ( storage. as_mut_ptr ( ) . cast ( ) ) ;
7474}
7575} )
7676. unwrap_err ( ) ;
@@ -89,13 +89,13 @@ fn test_clone_to_uninit_str() {
8989let a = "hello" ;
9090
9191let mut storage: MaybeUninit < [ u8 ; 5 ] > = MaybeUninit :: uninit ( ) ;
92- unsafe { a. clone_to_uninit ( storage. as_mut_ptr ( ) as * mut [ u8 ] as * mut str ) } ;
92+ unsafe { a. clone_to_uninit ( storage. as_mut_ptr ( ) . cast ( ) ) } ;
9393assert_eq ! ( a. as_bytes( ) , unsafe { storage. assume_init( ) } . as_slice( ) ) ;
9494
9595let mut b: Box < str > = "world" . into ( ) ;
9696assert_eq ! ( a. len( ) , b. len( ) ) ;
9797assert_ne ! ( a, & * b) ;
98- unsafe { a. clone_to_uninit ( ptr:: from_mut :: < str > ( & mut b) ) } ;
98+ unsafe { a. clone_to_uninit ( ptr:: from_mut :: < str > ( & mut b) . cast ( ) ) } ;
9999assert_eq ! ( a, & * b) ;
100100}
101101
@@ -104,13 +104,13 @@ fn test_clone_to_uninit_cstr() {
104104let a = c"hello" ;
105105
106106let mut storage: MaybeUninit < [ u8 ; 6 ] > = MaybeUninit :: uninit ( ) ;
107- unsafe { a. clone_to_uninit ( storage. as_mut_ptr ( ) as * mut [ u8 ] as * mut CStr ) } ;
107+ unsafe { a. clone_to_uninit ( storage. as_mut_ptr ( ) . cast ( ) ) } ;
108108assert_eq ! ( a. to_bytes_with_nul( ) , unsafe { storage. assume_init( ) } . as_slice( ) ) ;
109109
110110let mut b: Box < CStr > = c"world" . into ( ) ;
111111assert_eq ! ( a. count_bytes( ) , b. count_bytes( ) ) ;
112112assert_ne ! ( a, & * b) ;
113- unsafe { a. clone_to_uninit ( ptr:: from_mut :: < CStr > ( & mut b) ) } ;
113+ unsafe { a. clone_to_uninit ( ptr:: from_mut :: < CStr > ( & mut b) . cast ( ) ) } ;
114114assert_eq ! ( a, & * b) ;
115115}
116116
0 commit comments