You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move __getrandom_custom definition into a const block (#344)
This supersedes #341, and makes the following changes
- All the code for implementing `__getrandom_custom` is now in an
**named** `const` block (unnamed consts require Rust 1.37)
- I found this approch [here](https://internals.rust-lang.org/t/anonymous-modules/15441)
- Nothing inside the block can be referenced outside of it
- `__getrandom_custom` is marked `unsafe`
- It can't be accessed externally, but is "logically" unsafe as it
dereferences raw pointers
- The type of the function is moved to a typedef, so we can check that
the defined type matches that of `getrandom:getrandom`.
- Use `::core::result::Result` instead of `Result`
- Similar to use use of `from_raw_parts_mut` this prevents
compilation errors if `Result` is redefined.
Signed-off-by: Joe Richey <[email protected]>
0 commit comments