Skip to content

Commit fde4113

Browse files
dhardyvks
authored andcommitted
Document available error codes
1 parent d8f4ec8 commit fde4113

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

rand_core/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
- Bump MSRV to 1.36, various code improvements (#1011)
1010
- Update to getrandom v0.2 (#1041)
11-
- Fix: `next_u32_via_fill` and `next_u64_via_fill` now use LE as documented (#?)
11+
- Fix: `next_u32_via_fill` and `next_u64_via_fill` now use LE as documented (#1061)
1212
- Reduce usage of `unsafe` (#962, #963, #1011)
1313
- Annotate feature-gates in documentation (#1019)
14+
- Document available error codes (#1061)
1415
- Various documentation tweaks
1516
- Fix some clippy warnings (#1036)
1617
- Apply rustfmt (#926)

rand_core/src/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ impl Error {
2929
/// Codes at or above this point can be used by users to define their own
3030
/// custom errors.
3131
///
32+
/// This has a fixed value of `(1 << 31) + (1 << 30) = 0xC000_0000`,
33+
/// therefore the number of values available for custom codes is `1 << 30`.
34+
///
3235
/// This is identical to [`getrandom::Error::CUSTOM_START`](https://docs.rs/getrandom/latest/getrandom/struct.Error.html#associatedconstant.CUSTOM_START).
3336
pub const CUSTOM_START: u32 = (1 << 31) + (1 << 30);
3437
/// Codes below this point represent OS Errors (i.e. positive i32 values).

0 commit comments

Comments
 (0)