Rollup merge of #99757 - asquared31415:patch-1, r=Dylan-DPC

Make `transmute_copy` docs read better
This commit is contained in:
Matthias Krüger 2022-07-26 16:57:52 +02:00 committed by GitHub
commit a739e28aea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1000,7 +1000,7 @@ pub fn copy<T: Copy>(x: &T) -> T {
/// ///
/// This function will unsafely assume the pointer `src` is valid for [`size_of::<U>`][size_of] /// This function will unsafely assume the pointer `src` is valid for [`size_of::<U>`][size_of]
/// bytes by transmuting `&T` to `&U` and then reading the `&U` (except that this is done in a way /// bytes by transmuting `&T` to `&U` and then reading the `&U` (except that this is done in a way
/// that is correct even when `&U` makes stricter alignment requirements than `&T`). It will also /// that is correct even when `&U` has stricter alignment requirements than `&T`). It will also
/// unsafely create a copy of the contained value instead of moving out of `src`. /// unsafely create a copy of the contained value instead of moving out of `src`.
/// ///
/// It is not a compile-time error if `T` and `U` have different sizes, but it /// It is not a compile-time error if `T` and `U` have different sizes, but it