use $crate in macro (#270)

This is the recommended way of referring to the current crate in a macro.
This commit is contained in:
Leonardo Yvens 2022-07-08 07:48:06 +01:00 committed by GitHub
parent 63f861c684
commit 3d818a6a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,7 @@ macro_rules! register_custom_getrandom {
// We use an extern "C" function to get the guarantees of a stable ABI.
#[no_mangle]
extern "C" fn __getrandom_custom(dest: *mut u8, len: usize) -> u32 {
let f: fn(&mut [u8]) -> Result<(), ::getrandom::Error> = $path;
let f: fn(&mut [u8]) -> Result<(), $crate::Error> = $path;
let slice = unsafe { ::core::slice::from_raw_parts_mut(dest, len) };
match f(slice) {
Ok(()) => 0,