[roll] Roll fuchsia [zerocopy] Add transmute! macro

Add the `transmute!` macro, which is a memory-safe equivalent of the
`core::mem::transmute` function. The `transmute!` macro requires that
its argument is `AsBytes`, and produces a value of a type which must be
`FromBytes`. The two types must be of the same size.

The reason that this needs to be a macro and cannot be a function is
that there's currently no way to express in the type system the
requirement that two generic types must have the same size. The macro is
able to make use of the fact that `core::mem::transmute` (which
`transmute!` uses internally) is special-cased in the compiler, and can
thus use compiler magic to ensure that the two types have the same size.
As a result, `transmute!` can only be used in a context in which both
types are concrete types rather than generic type variables.

Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/569463
Original-Revision: 14b5ba00c9c19671b7b4e55f03f0c000d145a7ea
GitOrigin-RevId: ec618137d3b01116ce2c4baca086fad3b7193441
Change-Id: I3c94a092712990f96407b38b2244be64a5210a78
1 file changed
tree: 117e96983ba1c1b6e24b12aaf018c21bc4fdbaf4
  1. garnet/
  2. infra/
  3. peridot/
  4. third_party/
  5. topaz/
  6. zircon/
  7. firmware
  8. flower
  9. jiri.lock
  10. minimal
  11. prebuilts
  12. README.md
  13. stem
  14. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.