about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2025-08-15 19:51:33 +1000
committerZalathar <Zalathar@users.noreply.github.com>2025-08-15 20:24:13 +1000
commit44f5ec7d56acb21cad9bcc0dbc13e70a749f35aa (patch)
tree346cb276c0eef8a7b71104f94389edd1c084515e /compiler/rustc_codegen_llvm/src/back
parent8d0a04966c97eb2015c950396e54f31f5212a888 (diff)
downloadrust-44f5ec7d56acb21cad9bcc0dbc13e70a749f35aa.tar.gz
rust-44f5ec7d56acb21cad9bcc0dbc13e70a749f35aa.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs b/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
index 8e82013e94a..30b1c243de0 100644
--- a/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
+++ b/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
@@ -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,
             )