File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed
branches/dist-snap/src/librustc/middle/trans Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
9
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10
- refs/heads/dist-snap: 4f88ed36a132cf74d45d996b26c3587e0d54a2cf
10
+ refs/heads/dist-snap: cb1f957f71b4fafa3b9a39a03fe8b99df0c658a2
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
13
13
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
Original file line number Diff line number Diff line change @@ -1209,6 +1209,14 @@ fn C_struct(elts: &[ValueRef]) -> ValueRef {
1209
1209
}
1210
1210
}
1211
1211
1212
+ fn C_packed_struct(elts: &[ValueRef]) -> ValueRef {
1213
+ unsafe {
1214
+ do vec::as_imm_buf(elts) |ptr, len| {
1215
+ llvm::LLVMConstStruct(ptr, len as c_uint, True)
1216
+ }
1217
+ }
1218
+ }
1219
+
1212
1220
fn C_named_struct(T: TypeRef, elts: &[ValueRef]) -> ValueRef {
1213
1221
unsafe {
1214
1222
do vec::as_imm_buf(elts) |ptr, len| {
Original file line number Diff line number Diff line change @@ -455,15 +455,14 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
455
455
let discrim = base:: get_discrim_val ( cx, e. span , tid, vid) ;
456
456
let c_args = C_struct ( args. map ( |a| const_expr ( cx, * a) ) ) ;
457
457
458
- let fields = if !degen {
459
- ~[ discrim, c_args]
458
+ // FIXME (#1645): enum body alignment is generaly wrong.
459
+ if !degen {
460
+ C_packed_struct ( ~[ discrim, c_args] )
460
461
} else if size == 0 {
461
- ~[ discrim]
462
+ C_struct ( ~[ discrim] )
462
463
} else {
463
- ~[ c_args]
464
- } ;
465
-
466
- C_struct ( fields)
464
+ C_struct ( ~[ c_args] )
465
+ }
467
466
}
468
467
_ => cx. sess . span_bug ( e. span , ~"expected a struct def")
469
468
}
You can’t perform that action at this time.
0 commit comments