@@ -28,7 +28,7 @@ fn test_clone_to_uninit_slice_success() {
28
28
29
29
let mut storage: MaybeUninit < [ String ; 3 ] > = MaybeUninit :: uninit ( ) ;
30
30
let 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 ( ) ) ;
32
32
storage. assume_init ( )
33
33
} ;
34
34
@@ -70,7 +70,7 @@ fn test_clone_to_uninit_slice_drops_on_panic() {
70
70
let mut storage: MaybeUninit < [ CountsDropsAndPanics ; 3 ] > = MaybeUninit :: uninit ( ) ;
71
71
// This should panic halfway through
72
72
unsafe {
73
- a[ ..] . clone_to_uninit ( storage. as_mut_ptr ( ) as * mut [ CountsDropsAndPanics ] ) ;
73
+ a[ ..] . clone_to_uninit ( storage. as_mut_ptr ( ) . cast ( ) ) ;
74
74
}
75
75
} )
76
76
. unwrap_err ( ) ;
@@ -89,13 +89,13 @@ fn test_clone_to_uninit_str() {
89
89
let a = "hello" ;
90
90
91
91
let 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 ( ) ) } ;
93
93
assert_eq ! ( a. as_bytes( ) , unsafe { storage. assume_init( ) } . as_slice( ) ) ;
94
94
95
95
let mut b: Box < str > = "world" . into ( ) ;
96
96
assert_eq ! ( a. len( ) , b. len( ) ) ;
97
97
assert_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 ( ) ) } ;
99
99
assert_eq ! ( a, & * b) ;
100
100
}
101
101
@@ -104,13 +104,13 @@ fn test_clone_to_uninit_cstr() {
104
104
let a = c"hello" ;
105
105
106
106
let 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 ( ) ) } ;
108
108
assert_eq ! ( a. to_bytes_with_nul( ) , unsafe { storage. assume_init( ) } . as_slice( ) ) ;
109
109
110
110
let mut b: Box < CStr > = c"world" . into ( ) ;
111
111
assert_eq ! ( a. count_bytes( ) , b. count_bytes( ) ) ;
112
112
assert_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 ( ) ) } ;
114
114
assert_eq ! ( a, & * b) ;
115
115
}
116
116
0 commit comments