about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-06-16 17:48:24 +0000
committerbors <bors@rust-lang.org>2019-06-16 17:48:24 +0000
commit799cf3f603b5809a68853efcd779671cb8e046c4 (patch)
tree0577bb01d056e2191b1939b017699517e6245012
parente3175c34b4211d219f114d6dc608194ebaf03c44 (diff)
parent3fa7411050e5f712c28b6e97346e9da3833407bb (diff)
downloadrust-799cf3f603b5809a68853efcd779671cb8e046c4.tar.gz
rust-799cf3f603b5809a68853efcd779671cb8e046c4.zip
Auto merge of #61881 - glaubitz:sparc64-ffi-abi, r=petrochenkov
librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C…

…) (#61306)

In order to make sure that Rust's bitflags types are passed the same way in the Rust ABI as they are in the C ABI, we need to use the attribute repr(transparent) over the repr(C) attribute for the single-field bitflags structs in in order to prevent ABI mismatches. Thanks to Michael Karcher for finding this bug.
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index a71243c7c82..a5c295cd452 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -564,7 +564,7 @@ pub mod debuginfo {
 
     // These values **must** match with LLVMRustDIFlags!!
     bitflags! {
-        #[repr(C)]
+        #[repr(transparent)]
         #[derive(Default)]
         pub struct DIFlags: ::libc::uint32_t {
             const FlagZero                = 0;
@@ -593,7 +593,7 @@ pub mod debuginfo {
 
     // These values **must** match with LLVMRustDISPFlags!!
     bitflags! {
-        #[repr(C)]
+        #[repr(transparent)]
         #[derive(Default)]
         pub struct DISPFlags: ::libc::uint32_t {
             const SPFlagZero              = 0;