diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2025-05-10 21:09:16 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2025-05-11 14:26:14 +1000 |
| commit | 8764ecd0c14f9f3f083b84de893ab8e6f71100bc (patch) | |
| tree | e6a9657400a4820d053017ede6ec9b0b77d83d01 /compiler/rustc_codegen_llvm/src/llvm/ffi.rs | |
| parent | 7b84c9e9ca4b9c68c888b77762c31e180ee7af45 (diff) | |
| download | rust-8764ecd0c14f9f3f083b84de893ab8e6f71100bc.tar.gz rust-8764ecd0c14f9f3f083b84de893ab8e6f71100bc.zip | |
Add a searchable tag `PTR_LEN_STR` to explain `*const c_uchar` bindings
This module comment describes why it's OK for LLVM bindings to declare a parameter type of `*const c_uchar` for pointer/length strings, even though the corresponding parameter on the C/C++ side uses `const char *`. Adding a searchable term to each such parameter should make it easier for future maintainers to understand why `*const c_uchar` is being used instead of `*const c_char`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/ffi.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index a249cb86ed4..feaae19f0cd 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -1,7 +1,7 @@ //! Bindings to the LLVM-C API (`LLVM*`), and to our own `extern "C"` wrapper //! functions around the unstable LLVM C++ API (`LLVMRust*`). //! -//! ## Passing pointer/length strings as `*const c_uchar` +//! ## Passing pointer/length strings as `*const c_uchar` (PTR_LEN_STR) //! //! Normally it's a good idea for Rust-side bindings to match the corresponding //! C-side function declarations as closely as possible. But when passing `&str` @@ -1766,7 +1766,7 @@ unsafe extern "C" { pub(crate) fn LLVMDIBuilderCreateNameSpace<'ll>( Builder: &DIBuilder<'ll>, ParentScope: Option<&'ll Metadata>, - Name: *const c_uchar, + Name: *const c_uchar, // See "PTR_LEN_STR". NameLen: size_t, ExportSymbols: llvm::Bool, ) -> &'ll Metadata; |
