rust/library/core/tests
Dylan DPC d6f6084b24
Rollup merge of #95556 - declanvk:nonnull-provenance, r=dtolnay
Implement provenance preserving methods on NonNull

### Description
 Add the `addr`, `with_addr`, `map_addr` methods to the `NonNull` type, and map the address type to `NonZeroUsize`.

 ### Motivation
 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 adding these methods makes it more ergonomic.

 ### Testing
 Added a unit test of a non-null 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. I wanted to produce an ideal version of the same tagged pointer struct that preserved pointer provenance.

### Related

Extension of APIs proposed in #95228 . I can also split this out into a separate tracking issue if that is better (though I may need some pointers on how to do that).
2022-04-02 03:34:24 +02:00
..
fmt Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
hash add tests 2022-02-02 23:07:02 +09:00
iter Rollup merge of #94115 - scottmcm:iter-process-by-ref, r=yaahc 2022-03-18 21:50:44 +01:00
num skip slow int_log tests in Miri 2022-03-31 11:48:51 -04:00
ops
alloc.rs
any.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
array.rs add cfg_panic bootstrap 2022-02-10 22:10:08 +00:00
ascii.rs
atomic.rs
bool.rs
cell.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
char.rs Debug print char 0 as '\0' rather than '\u{0}' 2022-03-27 04:49:10 -07:00
clone.rs
cmp.rs Add test for StructuralEq for std::cmp::Ordering. 2022-03-16 14:01:48 -05:00
const_ptr.rs
convert.rs
future.rs add tests 2022-02-02 23:07:02 +09:00
intrinsics.rs Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
lazy.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
lib.rs Rollup merge of #95556 - declanvk:nonnull-provenance, r=dtolnay 2022-04-02 03:34:24 +02:00
macros.rs
manually_drop.rs
mem.rs add cfg_panic bootstrap 2022-02-10 22:10:08 +00:00
nonzero.rs
ops.rs
option.rs
pattern.rs
pin_macro.rs Write {ui,} tests for pin_macro and pin! 2022-02-14 16:56:37 +01:00
pin.rs
ptr.rs Rollup merge of #95556 - declanvk:nonnull-provenance, r=dtolnay 2022-04-02 03:34:24 +02:00
result.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
simd.rs Miri can run this test now 2022-03-03 14:54:18 -05:00
slice.rs add #[must_use] to functions of slice and its iterators. 2022-03-26 10:24:25 +01:00
str_lossy.rs
str.rs
task.rs
time.rs
tuple.rs
unicode.rs
waker.rs