File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -2546,23 +2546,29 @@ pub mod raw {
2546
2546
* would also make any pointers to it invalid.
2547
2547
*/
2548
2548
#[ inline( always) ]
2549
- pub unsafe fn to_ptr < T > ( v : & [ T ] ) -> * T {
2550
- let repr: * * SliceRepr = transmute ( & v) ;
2551
- transmute ( & ( ( * * repr) . data ) )
2549
+ pub fn to_ptr < T > ( v : & [ T ] ) -> * T {
2550
+ unsafe {
2551
+ let repr: * * SliceRepr = transmute ( & v) ;
2552
+ transmute ( & ( ( * * repr) . data ) )
2553
+ }
2552
2554
}
2553
2555
2554
2556
/** see `to_ptr()` */
2555
2557
#[ inline( always) ]
2556
- pub unsafe fn to_const_ptr < T > ( v : & const [ T ] ) -> * const T {
2557
- let repr: * * SliceRepr = transmute ( & v) ;
2558
- transmute ( & ( ( * * repr) . data ) )
2558
+ pub fn to_const_ptr < T > ( v : & const [ T ] ) -> * const T {
2559
+ unsafe {
2560
+ let repr: * * SliceRepr = transmute ( & v) ;
2561
+ transmute ( & ( ( * * repr) . data ) )
2562
+ }
2559
2563
}
2560
2564
2561
2565
/** see `to_ptr()` */
2562
2566
#[ inline( always) ]
2563
- pub unsafe fn to_mut_ptr < T > ( v : & mut [ T ] ) -> * mut T {
2564
- let repr: * * SliceRepr = transmute ( & v) ;
2565
- transmute ( & ( ( * * repr) . data ) )
2567
+ pub fn to_mut_ptr < T > ( v : & mut [ T ] ) -> * mut T {
2568
+ unsafe {
2569
+ let repr: * * SliceRepr = transmute ( & v) ;
2570
+ transmute ( & ( ( * * repr) . data ) )
2571
+ }
2566
2572
}
2567
2573
2568
2574
/**
You can’t perform that action at this time.
0 commit comments