diff options
| author | Mads Marquart <mads@marquart.dk> | 2025-03-26 15:23:47 +0100 |
|---|---|---|
| committer | Mads Marquart <mads@marquart.dk> | 2025-03-26 16:25:05 +0100 |
| commit | a7bafc0afc3dba988a7bf85198c493b20523eaa0 (patch) | |
| tree | 2a9a10286c82bd6a31ef625602c960e2b6f5f42e /library/std/src/sys/random | |
| parent | 65899c06f117ddac9c8399479ddcdc122c92fddf (diff) | |
| download | rust-a7bafc0afc3dba988a7bf85198c493b20523eaa0.tar.gz rust-a7bafc0afc3dba988a7bf85198c493b20523eaa0.zip | |
Change the syntax of the internal `weak!` macro
Change the syntax to include parameter names and a trailing semicolon. Motivation: - Mirror the `syscall!` macro. - Allow rustfmt to format it (when wrapped in parentheses). - For better documentation (having the parameter names available in the source code is a bit nicer). - Allow future improvements to this macro where we can sometimes use the symbol directly when it's statically known to be available.
Diffstat (limited to 'library/std/src/sys/random')
| -rw-r--r-- | library/std/src/sys/random/linux.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/sys/random/linux.rs b/library/std/src/sys/random/linux.rs index e3cb79285cd..c0591ec0c15 100644 --- a/library/std/src/sys/random/linux.rs +++ b/library/std/src/sys/random/linux.rs @@ -73,13 +73,13 @@ fn getrandom(mut bytes: &mut [u8], insecure: bool) { // A weak symbol allows interposition, e.g. for perf measurements that want to // disable randomness for consistency. Otherwise, we'll try a raw syscall. // (`getrandom` was added in glibc 2.25, musl 1.1.20, android API level 28) - syscall! { + syscall!( fn getrandom( buffer: *mut libc::c_void, length: libc::size_t, - flags: libc::c_uint - ) -> libc::ssize_t - } + flags: libc::c_uint, + ) -> libc::ssize_t; + ); static GETRANDOM_AVAILABLE: AtomicBool = AtomicBool::new(true); static GRND_INSECURE_AVAILABLE: AtomicBool = AtomicBool::new(true); |
