]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #38543 - philipc:unsized-debuginfo, r=michaelwoerister
authorbors <bors@rust-lang.org>
Mon, 2 Jan 2017 20:17:01 +0000 (20:17 +0000)
committerbors <bors@rust-lang.org>
Mon, 2 Jan 2017 20:17:01 +0000 (20:17 +0000)
Fix debuginfo for unsized struct members

The member was given the size of a fat pointer, which caused
llvm to emit DWARF attributes for a 128-bit bitfield.

1  2 
src/librustc_trans/debuginfo/metadata.rs

index b2d12c7e7d0f2a323130bdcefd4f74bdb2029b48,b18df4d97f116e5a46ab29ae2427a084c80074ed..f6428465eda203dbdd03823df5bbb8bb418a4af8
@@@ -906,7 -906,7 +906,7 @@@ impl<'tcx> StructMemberDescriptionFacto
  
              MemberDescription {
                  name: name,
-                 llvm_type: type_of::type_of(cx, fty),
+                 llvm_type: type_of::in_memory_type_of(cx, fty),
                  type_metadata: type_metadata(cx, fty, self.span),
                  offset: offset,
                  flags: DIFlags::FlagZero,
@@@ -1460,8 -1460,7 +1460,8 @@@ fn prepare_enum_metadata<'a, 'tcx>(cx: 
                  llvm::LLVMRustDIBuilderCreateEnumerator(
                      DIB(cx),
                      name.as_ptr(),
 -                    v.disr_val.to_u64_unchecked())
 +                    // FIXME: what if enumeration has i128 discriminant?
 +                    v.disr_val.to_u128_unchecked() as u64)
              }
          })
          .collect();