We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6647a34 commit 52cf61fCopy full SHA for 52cf61f
src/librustc/middle/trans/consts.rs
@@ -470,7 +470,12 @@ pub fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
470
471
// FIXME (#1645): enum body alignment is generaly wrong.
472
if !degen {
473
- C_packed_struct(~[discrim, c_args])
+ // A packed_struct has an alignment of 1; thus,
474
+ // wrapping one around c_args will misalign it the
475
+ // same way we normally misalign enum bodies
476
+ // without affecting its internal alignment or
477
+ // changing the alignment of the enum.
478
+ C_struct(~[discrim, C_packed_struct(~[c_args])])
479
} else if size == 0 {
480
C_struct(~[discrim])
481
} else {
0 commit comments