Skip to content

custom: rename __getrandom_internal to follow Rust conventions#369

Merged
newpavlov merged 1 commit intomasterfrom
rename_internal
Sep 1, 2023
Merged

custom: rename __getrandom_internal to follow Rust conventions#369
newpavlov merged 1 commit intomasterfrom
rename_internal

Conversation

@josephlr
Copy link
Member

@josephlr josephlr commented Sep 1, 2023

Fixes #368 CC: @ethever

This symbol isn't actually used anywhere, so it's fine to be renamed.

Once we are at MSRV 1.37, we can change the code to use an unnamed const, for example:

const _: () = {
    // We use Rust ABI to be safe against potential panics in the passed function.
    #[no_mangle]
    unsafe fn __getrandom_custom(dest: *mut u8, len: usize) -> u32 {

This symbol isn't actually used anywhere, so it's fine to be renamed.

Once we are at MSRV 1.37, we can change the code to use an
[unnamed `const`](https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.html#using-unnamed-const-items-for-macros),
for example:
```rust
const _: () = {
    // We use Rust ABI to be safe against potential panics in the passed function.
    #[no_mangle]
    unsafe fn __getrandom_custom(dest: *mut u8, len: usize) -> u32 {
```
@josephlr josephlr requested a review from newpavlov September 1, 2023 03:30
@newpavlov newpavlov merged commit 1308930 into master Sep 1, 2023
@newpavlov newpavlov deleted the rename_internal branch September 1, 2023 10:50
@newpavlov newpavlov mentioned this pull request Nov 7, 2023
takumi-earth pushed a commit to earthlings-dev/getrandom that referenced this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constant __getrandom_internal should have UPPER_SNAKE_CASE name, e.g. __GETRANDOM_INTERNALrust-analyzernon_upper_case_globals

2 participants