Skip to content

Commit 6d79df6

Browse files
authored
Rollup merge of rust-lang#134204 - Zalathar:llvm-bool, r=SparrowLii
Fix our `llvm::Bool` typedef to be signed, to match `LLVMBool` In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`, but our Rust-side typedef was using `c_uint` instead. Signed and unsigned integers have the same ABI on most platforms, but that isn't universally true, so we should prefer to be consistent with LLVM. https://github.com/rust-lang/llvm-project/blob/1268e87/llvm/include/llvm-c/Types.h#L28
2 parents f620e46 + f7c6a2c commit 6d79df6

File tree

1 file changed

+3
-1
lines changed
  • compiler/rustc_codegen_llvm/src/llvm

1 file changed

+3
-1
lines changed

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ use super::debuginfo::{
1717
DebugEmissionKind, DebugNameTableKind,
1818
};
1919

20-
pub type Bool = c_uint;
20+
/// In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`,
21+
/// which has a different ABI from Rust or C++ `bool`.
22+
pub type Bool = c_int;
2123

2224
pub const True: Bool = 1 as Bool;
2325
pub const False: Bool = 0 as Bool;

0 commit comments

Comments
 (0)