Skip to content

Commit 4b4b213

Browse files
committed
librustc: Don't ICE on packed structs in statics.
1 parent c6e3501 commit 4b4b213

File tree

1 file changed

+6
-1
lines changed
  • src/librustc/middle/trans

1 file changed

+6
-1
lines changed

src/librustc/middle/trans/adt.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,12 @@ pub fn trans_const(ccx: &mut CrateContext, r: &Repr, discr: Disr,
505505
}
506506
Univariant(ref st, _dro) => {
507507
assert_eq!(discr, 0);
508-
C_struct(build_const_struct(ccx, st, vals))
508+
let contents = build_const_struct(ccx, st, vals);
509+
if st.packed {
510+
C_packed_struct(contents)
511+
} else {
512+
C_struct(contents)
513+
}
509514
}
510515
General(ref cases) => {
511516
let case = &cases[discr];

0 commit comments

Comments
 (0)