diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-25 18:15:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-25 18:15:10 +0200 |
| commit | 781f71a6fee007c0b9dc93e2aaf5426ab8e24049 (patch) | |
| tree | 5645ca095f5c1571ee4f2e3173cbb8ff0562ef13 /tests/rustdoc/source-code-pages/check-source-code-urls-to-def.rs | |
| parent | 83cf8f98600a18c690ce890bd7c0f25c14351815 (diff) | |
| parent | 185ae698aabe0f6f7cc5ef7eeed13a556bce5334 (diff) | |
| download | rust-781f71a6fee007c0b9dc93e2aaf5426ab8e24049.tar.gz rust-781f71a6fee007c0b9dc93e2aaf5426ab8e24049.zip | |
Rollup merge of #146924 - cptpiepmatz:doc-nonzero-const-creation, r=joboet
Add doc for `NonZero*` const creation I ran into trouble using `NonZero*` values because I didn’t see any clear way to create them at compile time. At first I ended up using `NonZero*::new_unchecked` a lot, until I realized that `Option::unwrap` and `Option::expect` are `const` and can be used in a `const` context. With that, you can create non-zero values at compile time safely, without touching `unsafe`. This wasn’t obvious to me and my peers who’ve been using Rust for a while, so I thought adding a note to the docs would make it easier for others to discover. If this should be worded differently or placed in another location, we can do that. I just want to make this more obvious.
Diffstat (limited to 'tests/rustdoc/source-code-pages/check-source-code-urls-to-def.rs')
0 files changed, 0 insertions, 0 deletions
