Avoid an explicit cast from *const c_uchar to *const c_char

As noted in the `ffi` module docs, passing pointer/length byte strings from
Rust to C++ is easier if we declare them as `*const c_uchar` on the Rust side,
but `const char *` (possibly signed) on the C++ side. This is allowed because
both pointer types are ABI-compatible, regardless of char signedness.
This commit is contained in:
Zalathar
2025-08-15 19:51:33 +10:00
parent 8d0a04966c
commit 44f5ec7d56
2 changed files with 3 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
use std::ffi::{CStr, c_char};
use std::ffi::CStr;
use std::marker::PhantomData;
use std::ptr::NonNull;
@@ -71,7 +71,7 @@ impl OwnedTargetMachine {
output_obj_file.as_ptr(),
debug_info_compression.as_ptr(),
use_emulated_tls,
args_cstr_buff.as_ptr() as *const c_char,
args_cstr_buff.as_ptr(),
args_cstr_buff.len(),
use_wasm_eh,
)