File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1052,14 +1052,14 @@ pub const fn copy<T: Copy>(x: &T) -> T {
10521052#[ must_use]
10531053#[ stable( feature = "rust1" , since = "1.0.0" ) ]
10541054#[ rustc_const_unstable( feature = "const_transmute_copy" , issue = "83165" ) ]
1055- pub const unsafe fn transmute_copy < Src , Dst > ( src : & Src ) -> Dst {
1055+ pub const unsafe fn transmute_copy < Src : ? Sized , Dst > ( src : & Src ) -> Dst {
10561056 assert ! (
1057- size_of :: < Src > ( ) >= size_of:: <Dst >( ) ,
1057+ size_of_val ( src ) >= size_of:: <Dst >( ) ,
10581058 "cannot transmute_copy if Dst is larger than Src"
10591059 ) ;
10601060
10611061 // If Dst has a higher alignment requirement, src might not be suitably aligned.
1062- if align_of :: < Dst > ( ) > align_of :: < Src > ( ) {
1062+ if align_of :: < Dst > ( ) > align_of_val ( src ) {
10631063 // SAFETY: `src` is a reference which is guaranteed to be valid for reads.
10641064 // The caller must guarantee that the actual transmutation is safe.
10651065 unsafe { ptr:: read_unaligned ( src as * const Src as * const Dst ) }
You can’t perform that action at this time.
0 commit comments