File tree 1 file changed +3
-3
lines changed
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 {
1052
1052
#[ must_use]
1053
1053
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1054
1054
#[ 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 {
1056
1056
assert ! (
1057
- size_of :: < Src > ( ) >= size_of:: <Dst >( ) ,
1057
+ size_of_val ( src ) >= size_of:: <Dst >( ) ,
1058
1058
"cannot transmute_copy if Dst is larger than Src"
1059
1059
) ;
1060
1060
1061
1061
// 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 ) {
1063
1063
// SAFETY: `src` is a reference which is guaranteed to be valid for reads.
1064
1064
// The caller must guarantee that the actual transmutation is safe.
1065
1065
unsafe { ptr:: read_unaligned ( src as * const Src as * const Dst ) }
You can’t perform that action at this time.
0 commit comments