Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move __getrandom_custom definition into a const block #344

Merged
merged 2 commits into from Mar 10, 2023
Merged

Commits on Mar 9, 2023

  1. ci: Fix the fuchsia tests

    The target triple name was changed in rust-lang/rust#106429
    
    While `rustc` known the old spelling of the triple, `rustup` does not,
    so the toolchain download was not working.
    
    Signed-off-by: Joe Richey <joerichey@google.com>
    josephlr committed Mar 9, 2023
    Copy the full SHA
    93c3074 View commit details
    Browse the repository at this point in the history

Commits on Mar 10, 2023

  1. Move __getrandom_custom definition into an unnamed block

    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 <joerichey@google.com>
    josephlr committed Mar 10, 2023
    Copy the full SHA
    4072098 View commit details
    Browse the repository at this point in the history