From 4b4b2136e048c39c60c8289f4cd1c870d4aaaeb0 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Sat, 12 Oct 2013 21:42:24 -0400 Subject: [PATCH] librustc: Don't ICE on packed structs in statics. --- src/librustc/middle/trans/adt.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 0fdbc04a6c1..2494b854f26 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -505,7 +505,12 @@ pub fn trans_const(ccx: &mut CrateContext, r: &Repr, discr: Disr, } Univariant(ref st, _dro) => { assert_eq!(discr, 0); - C_struct(build_const_struct(ccx, st, vals)) + let contents = build_const_struct(ccx, st, vals); + if st.packed { + C_packed_struct(contents) + } else { + C_struct(contents) + } } General(ref cases) => { let case = &cases[discr];