about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorDeclan Kelly <dkelly.home@gmail.com>2022-04-01 00:19:10 -0700
committerDeclan Kelly <dkelly.home@gmail.com>2022-04-01 00:23:09 -0700
commit2a827635ba65e3d40af8643373e4584858eecc7d (patch)
tree391d17d9099b9f37cecb5ad58e2fb3b58691a947 /compiler/rustc_interface/src
parent0677edc86e342f333d4828b0ee1ef395a4e70fe5 (diff)
downloadrust-2a827635ba65e3d40af8643373e4584858eecc7d.tar.gz
rust-2a827635ba65e3d40af8643373e4584858eecc7d.zip
Implement provenance preserving method on NonNull
**Description**
 Add the `addr`, `with_addr, `map_addr` methods to the `NonNull` type,
 and map the address type to `NonZeroUsize`.

 **Motiviation**
 The `NonNull` type is useful for implementing pointer types which have
 the 0-niche. It is currently possible to implement these provenance
 preserving functions by calling `NonNull::as_ptr` and `new_unchecked`.
 The addition of these methods simply make it more ergonomic to use.

 **Testing**
 Added a unit test of a nonnull tagged pointer type. This is based on
 some real code I have elsewhere, that currently routes the pointer
 through a `NonZeroUsize` and back out to produce a usable pointer.
Diffstat (limited to 'compiler/rustc_interface/src')
0 files changed, 0 insertions, 0 deletions