@@ -4347,14 +4347,30 @@ mod simd {
4347
4347
/// Safely transmutes a value of one type to a value of another type of the same
4348
4348
/// size.
4349
4349
///
4350
- /// The expression `$e` must have a concrete type, `T`, which implements
4351
- /// `IntoBytes`. The `transmute!` expression must also have a concrete type, `U`
4352
- /// (`U` is inferred from the calling context), and `U` must implement
4353
- /// `FromBytes`.
4350
+ /// This macro behaves like an invocation of this function:
4354
4351
///
4355
- /// Note that the `T` produced by the expression `$e` will *not* be dropped.
4356
- /// Semantically, its bits will be copied into a new value of type `U`, the
4357
- /// original `T` will be forgotten, and the value of type `U` will be returned.
4352
+ /// ```ignore
4353
+ /// const fn transmute<Src, Dst>(src: Src) -> Dst
4354
+ /// where
4355
+ /// Src: IntoBytes,
4356
+ /// Dst: FromBytes,
4357
+ /// size_of::<Src>() == size_of::<Dst>(),
4358
+ /// {
4359
+ /// # /*
4360
+ /// ...
4361
+ /// # */
4362
+ /// }
4363
+ /// ```
4364
+ ///
4365
+ /// However, unlike a function, this macro can only be invoked when the types of
4366
+ /// `Src` and `Dst` are completely concrete. The types `Src` and `Dst` are
4367
+ /// inferred from the calling context; they cannot be explicitly specified in
4368
+ /// the macro invocation.
4369
+ ///
4370
+ /// Note that the `Src` produced by the expression `$e` will *not* be dropped.
4371
+ /// Semantically, its bits will be copied into a new value of type `Dst`, the
4372
+ /// original `Src` will be forgotten, and the value of type `Dst` will be
4373
+ /// returned.
4358
4374
///
4359
4375
/// # Examples
4360
4376
///
@@ -4562,13 +4578,27 @@ macro_rules! transmute_ref {
4562
4578
/// Safely transmutes a mutable reference of one type to a mutable reference of
4563
4579
/// another type of the same size.
4564
4580
///
4565
- /// The expression `$e` must have a concrete type, `&mut T`, where `T: Sized +
4566
- /// IntoBytes`. The `transmute_mut!` expression must also have a concrete type,
4567
- /// `&mut U` (`U` is inferred from the calling context), where `U: Sized +
4568
- /// FromBytes`. It must be the case that `align_of::<T>() >= align_of::<U>()`.
4581
+ /// This macro behaves like an invocation of this function:
4569
4582
///
4570
- /// The lifetime of the input type, `&mut T`, must be the same as or outlive the
4571
- /// lifetime of the output type, `&mut U`.
4583
+ /// ```ignore
4584
+ /// const fn transmute_mut<'src, 'dst, Src, Dst>(src: &'src mut Src) -> &'dst mut Dst
4585
+ /// where
4586
+ /// 'src: 'dst,
4587
+ /// Src: FromBytes + IntoBytes + NoCell,
4588
+ /// Dst: FromBytes + IntoBytes + NoCell,
4589
+ /// size_of::<Src>() == size_of::<Dst>(),
4590
+ /// align_of::<Src>() >= align_of::<Dst>(),
4591
+ /// {
4592
+ /// # /*
4593
+ /// ...
4594
+ /// # */
4595
+ /// }
4596
+ /// ```
4597
+ ///
4598
+ /// However, unlike a function, this macro can only be invoked when the types of
4599
+ /// `Src` and `Dst` are completely concrete. The types `Src` and `Dst` are
4600
+ /// inferred from the calling context; they cannot be explicitly specified in
4601
+ /// the macro invocation.
4572
4602
///
4573
4603
/// # Examples
4574
4604
///
0 commit comments