@@ -4418,14 +4418,27 @@ macro_rules! transmute {
4418
4418
/// Safely transmutes a mutable or immutable reference of one type to an
4419
4419
/// immutable reference of another type of the same size.
4420
4420
///
4421
- /// The expression `$e` must have a concrete type, `&T` or `&mut T`, where `T:
4422
- /// Sized + IntoBytes`. The `transmute_ref!` expression must also have a
4423
- /// concrete type, `&U` (`U` is inferred from the calling context), where `U:
4424
- /// Sized + FromBytes`. It must be the case that `align_of::<T>() >=
4425
- /// align_of::<U>()`.
4421
+ /// This macro behaves like an invocation of this function:
4422
+ ///
4423
+ /// ```ignore
4424
+ /// const fn transmute_ref<'src, 'dst, Src, Dst>(src: &'src Src) -> &'dst Dst
4425
+ /// where
4426
+ /// 'src: 'dst,
4427
+ /// Src: IntoBytes + NoCell,
4428
+ /// Dst: FromBytes + NoCell,
4429
+ /// size_of::<Src>() == size_of::<Dst>(),
4430
+ /// align_of::<Src>() >= align_of::<Dst>(),
4431
+ /// {
4432
+ /// # /*
4433
+ /// ...
4434
+ /// # */
4435
+ /// }
4436
+ /// ```
4426
4437
///
4427
- /// The lifetime of the input type, `&T` or `&mut T`, must be the same as or
4428
- /// outlive the lifetime of the output type, `&U`.
4438
+ /// However, unlike a function, this macro can only be invoked when the types of
4439
+ /// `Src` and `Dst` are completely concrete. The types `Src` and `Dst` are
4440
+ /// inferred from the calling context; they cannot be explicitly specified in
4441
+ /// the macro invocation.
4429
4442
///
4430
4443
/// # Examples
4431
4444
///
0 commit comments