about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2019-06-16 02:53:33 +0200
committerJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2019-06-16 02:53:33 +0200
commit3fa7411050e5f712c28b6e97346e9da3833407bb (patch)
treed5d2ad952bced945c0c7a88530a69b6d7f2a6fc9 /src/librustc_codegen_llvm
parent0dc9e9c10ca6dc78cba8b9f9b15038c977b10a77 (diff)
downloadrust-3fa7411050e5f712c28b6e97346e9da3833407bb.tar.gz
rust-3fa7411050e5f712c28b6e97346e9da3833407bb.zip
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.
Diffstat (limited to 'src/librustc_codegen_llvm')
-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;